How to custom the interval data type? #2580
|
I have this query: I want the method CreateSnippet also taking a day number (like 7) as an argument or even the whole interval as an argument. What should I do? |
Answered by
andrewmbenton
Aug 11, 2023
Replies: 2 comments 2 replies
|
Please use MAKE_INTERVAL or |
0 replies
|
If you use If you're not using |
2 replies
Answer selected by
andrewmbenton
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you use
pgx/v5as your driver then it looks like sqlc will give you apgtype.Intervalto use as a parameter, which is probably pretty comfortable to use. https://play.sqlc.dev/p/0ae27106633b32760f9c1072009605e1b294a1ed7563290509c7daa462796a31If you're not using
pgx/v5then I think the above suggestion from @orisano to useMAKE_INTERVALis best: https://play.sqlc.dev/p/147a2e77fe7e64ffd21af152bb67e447b616bf388410a225df25bde7ed1f0f5e