Skip to content

Commit 5652589

Browse files
kalbasitclaude
andcommitted
fix: address PR comments about field names and redundant rows.Close()
- Use sqlc.arg() to name unnest parameters in AddBookTags query, generating BookIds/TagIds instead of Column1/Column2 - Remove redundant rows.Close() calls in MySQL and SQLite generated files for GetBookTags, GetBooksByAuthor, and ListBooks functions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 996c489 commit 5652589

8 files changed

Lines changed: 15 additions & 33 deletions

File tree

example/db/query.postgres.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ VALUES ($1, $2);
5858
-- INSERT INTO book_tags ("book_id", "tag_id") VALUES (unnest($1::bigint[]), unnest($2::bigint[]))
5959
-- @bulk-for AddBookTag
6060
INSERT INTO book_tags ("book_id", "tag_id")
61-
VALUES (unnest($1::bigint[]), unnest($2::bigint[]));
61+
VALUES (unnest(sqlc.arg(book_ids)::bigint[]), unnest(sqlc.arg(tag_ids)::bigint[]));
6262

6363
-- name: GetBookTags :many
6464
-- SELECT t."id", t."name", t."created_at", t."updated_at" FROM tags t INNER JOIN book_tags bt ON t.id = bt.tag_id WHERE bt.book_id = $1

example/pkg/database/generated_models.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/generated_wrapper_mysql.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/generated_wrapper_postgres.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/generated_wrapper_sqlite.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/mysqldb/query.mysql.sql.go

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/postgresdb/query.postgres.sql.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pkg/database/sqlitedb/query.sqlite.sql.go

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)