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.15.0
When a type override is defined for a column, it only applies to parameters if they are positional or named the same as the column itself.
In the example below, I expected to generate
func (q *Queries) Renamed(ctx context.Context, userEmail user.Email) (user.ID, error)
but with a named parameter I got
func (q *Queries) Renamed(ctx context.Context, userEmail string) (user.ID, error)
unless the parameter was named email (which matches the inferred name, so isn't very useful!).
email
No response
CREATE TABLE users ( id bigserial PRIMARY KEY, email text NOT NULL CONSTRAINT unique_email UNIQUE );
-- name: Renamed :one SELECT id FROM users WHERE email = @user_email;
{ "version": "2", "sql": [ { "engine": "postgresql", "schema": "query.sql", "queries": "query.sql", "gen": { "go": { "out": "db", "overrides": [ { "column": "users.id", "go_type": "example.com/user.ID" }, { "column": "users.email", "go_type": "example.com/user.Email" } ] } } } ] }
https://play.sqlc.dev/p/f212e1ed3b1d4e565c9b65b599a017c20586d8169b10f89d88859723a95ce265
macOS
PostgreSQL
Go
The text was updated successfully, but these errors were encountered:
Previously reported in #606 and #1752, so I'm going to close this.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Version
1.15.0
What happened?
When a type override is defined for a column, it only applies to parameters if they are positional or named the same as the column itself.
In the example below, I expected to generate
but with a named parameter I got
unless the parameter was named
email
(which matches the inferred name, so isn't very useful!).Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/f212e1ed3b1d4e565c9b65b599a017c20586d8169b10f89d88859723a95ce265
What operating system are you using?
macOS
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: