Skip to content

Custom Go types for query parameters #607

Answered by kyleconroy
tv42 asked this question in General
Discussion options

You must be logged in to vote

There are a few different solutions we could employ to solve this issue.

The first is applying type overrides to parameters. If we know that a parameter directly refers to table.column, sqlc should apply the type override to that parameter. This becomes more complicated if a table has a foreign key to a column. Currently you need to add a separate type override for those columns. I don't imagine changing that behavior right now.

The second solution may lie in #434. If you created a domain for FooID and BarID, you would only need to override a single type.

For now, I've created #671 to track the first solution.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kyleconroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #607 on August 23, 2020 19:56.