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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Please use MAKE_INTERVAL or |
Beta Was this translation helpful? Give feedback.
-
If you use If you're not using |
Beta Was this translation helpful? Give feedback.
If you use
pgx/v5
as your driver then it looks like sqlc will give you apgtype.Interval
to use as a parameter, which is probably pretty comfortable to use. https://play.sqlc.dev/p/0ae27106633b32760f9c1072009605e1b294a1ed7563290509c7daa462796a31If you're not using
pgx/v5
then I think the above suggestion from @orisano to useMAKE_INTERVAL
is best: https://play.sqlc.dev/p/147a2e77fe7e64ffd21af152bb67e447b616bf388410a225df25bde7ed1f0f5e