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?
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"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
-
|
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.
-
|
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/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