Skip to content
\n

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

\n

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

","upvoteCount":1,"url":"https://github.com/sqlc-dev/sqlc/discussions/2580#discussioncomment-6704223"}}}
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 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@soasada
Comment options

@brahmlower
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
5 participants