Skip to content

Conversation

andrewmbenton
Copy link
Collaborator

  • also remove some dead code
* also remove some dead code
@daison12006013
Copy link

daison12006013 commented Sep 21, 2023

@andrewmbenton is there a documentation as well if we can re-use a certain override block in sqlc.yaml?

overrides: go: overrides: - column: "profiles.payment_flag" - column: "profileviews.is_active_member" - column: "profileviews.is_active_profile" nullable: true go_type: import: "gopkg.in/guregu/null.v4" package: "null" type: "Bool" - db_type: "varchar" - db_type: "text" - db_type: "json" nullable: true go_type: import: "gopkg.in/guregu/null.v4" package: "null" type: "String"

As an example above, where in the 3 columns will have a null.Bool.

Meanwhile I am using anchors, somewhat like this

 # Boolean specific columns - column: "profiles.payment_flag" nullable: true go_type: &nullBoolean import: "gopkg.in/guregu/null.v4" package: "null" type: "Bool" - column: "profileviews.is_active_member" nullable: true go_type: *nullBoolean - column: "profileviews.is_active_profile" nullable: true go_type: *nullBoolean # String - db_type: "varchar" nullable: true go_type: &nullString import: "gopkg.in/guregu/null.v4" package: "null" type: "String" - db_type: "text" nullable: true go_type: *nullString - db_type: "json" nullable: true go_type: *nullString
@andrewmbenton
Copy link
Collaborator Author

As an example above, where in the 3 columns will have a null.Bool.

This "fallthrough" behavior won't work as far as I know, although I think it is technically possible to implement. The anchors solution seems like the best way to reduce redundancy at the moment.

@andrewmbenton andrewmbenton merged commit ac32049 into main Sep 21, 2023
@andrewmbenton andrewmbenton deleted the andrew/docs-update branch September 21, 2023 16:15
alfonsodev pushed a commit to ExponentiaTeam/sqlc that referenced this pull request Oct 13, 2025
* docs: clarify nullable override behavior * also remove some dead code * docs: sync config v1 yaml example with list of go options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants