You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever you create a table, a composite type is also automatically created, with the same name as the table, to represent the table's row type. For example, had we said:
CREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
bio text
);
-- name: AutomatiicType :manyselect authors from authors;
Support for composite types of a TABLE/TYPE would be great. A further improvement would be supporting arbitrary record types that don't belong to a TABLE/TYPE if that would be possible.
Following! Our schema defines tables that use custom types, some of which use additional custom types. My expectation was that Go structs would be generated for these types as they are for tables. Is #309 (comment) still the recommended workaround: create Go structs for custom types by hand then use these in overrides? Thank you!
Activity
kirk-anchor commentedon Sep 27, 2023
Support for composite types of a TABLE/TYPE would be great. A further improvement would be supporting arbitrary record types that don't belong to a TABLE/TYPE if that would be possible.
Yiwen-Gao commentedon Dec 24, 2023
Following! Our schema defines tables that use custom types, some of which use additional custom types. My expectation was that Go structs would be generated for these types as they are for tables. Is #309 (comment) still the recommended workaround: create Go structs for custom types by hand then use these in
overrides? Thank you!Details
Schema definitions:
sqlc-generated Go code:
pdewilde commentedon Jan 18, 2024
I ran into wanting this because I was using composite types in history tables. See my (now closed) issue #3148 for my motivating example.