We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.24.0
The code imports the unused "strings" package.
// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.24.0 // source: query.sql package tutorial import ( "context" "strings" ) const getAuthor = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = any($1) ` func (q *Queries) GetAuthor(ctx context.Context, idList []int64) (Author, error) { row := q.db.QueryRow(ctx, getAuthor, idList) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err }
CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, name text NOT NULL, bio text );
-- name: GetAuthor :one SELECT * FROM authors WHERE id = any(sqlc.slice('id_list'));
version: "2" sql: - engine: "postgresql" queries: "query.sql" schema: "schema.sql" gen: go: package: "tutorial" out: "tutorial" sql_package: "pgx/v5"
https://play.sqlc.dev/p/7f1ba3b245cc4cbdf50a7512c4a598d701d80eda56de8ef60fd26393e3ca1605
Linux
PostgreSQL
Go
The text was updated successfully, but these errors were encountered:
fix(codegen/golang): Don't import "strings" for sqlc.slice() with…
"strings"
sqlc.slice()
b1520bd
… pgx Also fix the invalid test that should have caught this Resolves #3065
ce95162
… pgx (#3073) Also fix the invalid test that should have caught this Resolves #3065
I think you might be better off using:
SELECT * FROM authors WHERE id = any(sqlc.arg('id_list')::integer[]);
This side-steps the bug and is probably better for statement caching done by the client.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Version
1.24.0
What happened?
The code imports the unused "strings" package.
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/7f1ba3b245cc4cbdf50a7512c4a598d701d80eda56de8ef60fd26393e3ca1605
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: