MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / CreateBook

Method CreateBook

examples/booktest/postgresql/query.sql.go:142–164  ·  view source on GitHub ↗
(ctx context.Context, arg CreateBookParams)

Source from the content-addressed store, hash-verified

140}
141
142func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) {
143 row := q.db.QueryRow(ctx, createBook,
144 arg.AuthorID,
145 arg.Isbn,
146 arg.BookType,
147 arg.Title,
148 arg.Year,
149 arg.Available,
150 arg.Tags,
151 )
152 var i Book
153 err := row.Scan(
154 &i.BookID,
155 &i.AuthorID,
156 &i.Isbn,
157 &i.BookType,
158 &i.Title,
159 &i.Year,
160 &i.Available,
161 &i.Tags,
162 )
163 return i, err
164}
165
166const deleteBook = `-- name: DeleteBook :exec
167DELETE FROM books

Callers

nothing calls this directly

Calls 2

QueryRowMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected