Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
56 lines
1.0 KiB
Plaintext
56 lines
1.0 KiB
Plaintext
--- a/go/models.go
|
|
+++ b/go/models.go
|
|
@@ -13,3 +13,8 @@
|
|
Name string
|
|
Bio sql.NullString
|
|
}
|
|
+
|
|
+type Book struct {
|
|
+ ID int64
|
|
+ Title string
|
|
+}
|
|
--- a/go/query.sql.go
|
|
+++ b/go/query.sql.go
|
|
@@ -31,16 +31,6 @@
|
|
return i, err
|
|
}
|
|
|
|
-const deleteAuthor = `-- name: DeleteAuthor :exec
|
|
-DELETE FROM authors
|
|
-WHERE id = $1
|
|
-`
|
|
-
|
|
-func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error {
|
|
- _, err := q.db.ExecContext(ctx, deleteAuthor, id)
|
|
- return err
|
|
-}
|
|
-
|
|
const getAuthor = `-- name: GetAuthor :one
|
|
SELECT id, name, bio FROM authors
|
|
WHERE id = $1 LIMIT 1
|
|
@@ -55,7 +45,7 @@
|
|
|
|
const listAuthors = `-- name: ListAuthors :many
|
|
SELECT id, name, bio FROM authors
|
|
+ORDER BY bio
|
|
-ORDER BY name
|
|
`
|
|
|
|
func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) {
|
|
@@ -80,3 +70,14 @@
|
|
}
|
|
return items, nil
|
|
}
|
|
+
|
|
+const selectOne = `-- name: SelectOne :one
|
|
+SELECT 1
|
|
+`
|
|
+
|
|
+func (q *Queries) SelectOne(ctx context.Context) (int32, error) {
|
|
+ row := q.db.QueryRowContext(ctx, selectOne)
|
|
+ var column_1 int32
|
|
+ err := row.Scan(&column_1)
|
|
+ return column_1, err
|
|
+}
|
|
|