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: truego_type: import: "gopkg.in/guregu/null.v4"package: "null"type: "Bool" - db_type: "varchar" - db_type: "text" - db_type: "json"nullable: truego_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: truego_type: &nullBooleanimport: "gopkg.in/guregu/null.v4"package: "null"type: "Bool" - column: "profileviews.is_active_member"nullable: truego_type: *nullBoolean - column: "profileviews.is_active_profile"nullable: truego_type: *nullBoolean# String - db_type: "varchar"nullable: truego_type: &nullStringimport: "gopkg.in/guregu/null.v4"package: "null"type: "String" - db_type: "text"nullable: truego_type: *nullString - db_type: "json"nullable: truego_type: *nullString

@andrewmbenton
Copy link
CollaboratorAuthor

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.

@andrewmbentonandrewmbenton merged commit ac32049 into mainSep 21, 2023
@andrewmbentonandrewmbenton 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@andrewmbenton@daison12006013