Skip to content

How to custom the interval data type? #2580

Answered by andrewmbenton
katatrina asked this question in Q&A
Discussion options

You must be logged in to vote

If you use pgx/v5 as your driver then it looks like sqlc will give you a pgtype.Interval to use as a parameter, which is probably pretty comfortable to use. https://play.sqlc.dev/p/0ae27106633b32760f9c1072009605e1b294a1ed7563290509c7daa462796a31

If you're not using pgx/v5 then I think the above suggestion from @orisano to use MAKE_INTERVAL is best: https://play.sqlc.dev/p/147a2e77fe7e64ffd21af152bb67e447b616bf388410a225df25bde7ed1f0f5e

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@soasada
Comment options

Answer selected by andrewmbenton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants