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.22.0
When omit_unused_structs is set to true, enums inside an sqlc.embed is ignored. This can cause invalid golang code due to undefined type on the model.
omit_unused_structs
true
Can be circumvented by creating another query without embed just so the enum model exists in the generated code.
check generated models.go
CREATE TYPE enumtype AS ENUM('a','b'); CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, e enumtype not null );
-- name: GetAllAuthors :one SELECT sqlc.embed(authors) FROM authors;
{ "version": "1", "packages": [ { "path": "db", "engine": "postgresql", "schema": "query.sql", "queries": "query.sql", "omit_unused_structs": true } ] }
https://play.sqlc.dev/p/2203df48ffefbead62b4871ccb2269b8cdd425c64c27108b7857d79c89a5596d
Linux, Windows
PostgreSQL
Go
The text was updated successfully, but these errors were encountered:
fix(codegen/go): Prevent filtering of embedded struct fields
86899b5
Resolves #2860
fix(codegen/go): Prevent filtering of embedded struct fields (#2868)
bd46afa
Successfully merging a pull request may close this issue.
Version
1.22.0
What happened?
When
omit_unused_structs
is set totrue
, enums inside an sqlc.embed is ignored. This can cause invalid golang code due to undefined type on the model.Can be circumvented by creating another query without embed just so the enum model exists in the generated code.
Relevant log output
check generated models.go
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/2203df48ffefbead62b4871ccb2269b8cdd425c64c27108b7857d79c89a5596d
What operating system are you using?
Linux, Windows
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: