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.27.0
The config parameter go_struct_tag works as expected when overriding a column, but not when overriding a type.
go_struct_tag
With the attached config, I hoped that the generated type would be like:
type Author struct { ID int64 Name string Bio *string `type_override:"doesnt_work"` Bio2 *string `column_override:"works!"` }
but the actual type is:
type Author struct { ID int64 Name string Bio *string Bio2 *string `column_override:"works!"` }
No response
CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, name text NOT NULL, bio text, bio2 text );
-- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1;
{ "version": "2", "sql": [ { "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { "go": { "out": "db", "overrides": [ { "db_type": "text", "go_type": { "type": "string", "pointer": true }, "nullable": true, "go_struct_tag": "type_override:\"doesnt_work\"" }, { "column": "authors.bio2", "go_type": { "type": "string", "pointer": true }, "nullable": true, "go_struct_tag": "column_override:\"works!\"" } ] } } } ] }
https://play.sqlc.dev/p/784492da14076cb054559e87ad78b0fdb311b7318db65b58564b8a5fa78b2469
Linux
PostgreSQL
Go
The text was updated successfully, but these errors were encountered:
There seems to already be a PR addressing this issue: #3287 but I could take a look and try to simplify it
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Version
1.27.0
What happened?
The config parameter
go_struct_tag
works as expected when overriding a column, but not when overriding a type.With the attached config, I hoped that the generated type would be like:
but the actual type is:
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/784492da14076cb054559e87ad78b0fdb311b7318db65b58564b8a5fa78b2469
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: