Open illiafox opened 1 month ago
I am having a similar issue with Sqlite3 where I have the following override:
emit_pointers_for_null_types: true
overrides:
- column: "*.*_id"
go_type: "github.com/kyren223/eko/pkg/snowflake.ID"
I expect that if the column is not annotated with NOT NULL it should generate a pointer to that type, and only if it's NOT NULL it will generate the normal type.
EDIT: If I don't specify a type, it correctly uses int64 and *int64 bot if I override then it doesn't work
overrides:
- db_type: "uuid"
go_type: "github.com/google/uuid.UUID"
- db_type: "uuid"
go_type:
import: "github.com/google/uuid"
type: "UUID"
pointer: true
nullable: true
https://play.sqlc.dev/p/773268972b4140b3d2aca91fd2d1adcda771c84cb7f177008894b8bf78055c35 I found a workaround, but I am not sure that it solves all cases
I am using Sqlite3 which has only 5 basic types which means I need to use column instead of db_type, and nullable doesn't work on column types. Maybe this should be a separate issue? it's the same problem but different context
Version
1.27.0
What happened?
Generated
models.go
I expect sqlc to generate
ParentID *uuid.UUID
, because this column is nullableRelevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/5121c5319cdf6954e4bbfd00e098390d567401afe8cd5418ce9fb4217ac902c7
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go