Generate Bun-native PostgreSQL array fields with configurable nullable representation #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
relspecgo currently generates PostgreSQL array columns such as
text[]as wrapper structs:Fixed in commit
5d9ff5d.What changed (pkg/writers/bun):
arraybun tag and plaintype:text[], in every --types mode (sqltypes/stdlib/baselib). The SqlXxxArray wrapper types are no longer used for Bun array columns.Tags []string \bun:"tags,array,type:text[],default:'{}',notnull,` json:"tags"`, orTags *[]string `bun:"tags,array,type:text[],nullzero,` json:"tags"`` with --array-nullable pointer_slice.Verification: Ran live against a real PostgreSQL instance (not just unit tests) — inserted/selected NULL, {}, and populated arrays for both NOT NULL and nullable columns, and confirmed native slice fields scan correctly alongside sql_types.SqlString-style scalar fields in the same model. Added pkg/writers/bun/array_integration_test.go (gated on RELSPEC_TEST_PG_CONN, same convention as the existing pgsql reader tests) covering these cases, plus unit tests for the type-mapper changes.
Note: gorm output is unaffected — it still uses the SqlXxxArray wrapper types from pkg/sqltypes.
Docs updated in pkg/writers/bun/README.md and the root README.md.