-
Notifications
You must be signed in to change notification settings - Fork 962
how to use sqlc without context ? #1837
-
hi guys: I have a cron job to do ( fetch third party data and save it to DB)
and have to write to the postgres database.
sqlc requires ctx context.Context but i am not writing an api for a client to call.
that means no request context via browser. all i want to do is simply write the fetched data to database.
I guess i have three options:
- just remove the ctx of the generated codes
- fake a useless ctx in order to write things into db
- use other golang tools and directly write sql statement (any recommendation ?
is there any better solution ? or i am just wrong with something ?
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
kyleconroy
Sep 8, 2022
Contexts are very easy to create. A simple context.Background() will suffice.
Replies: 1 comment 1 reply
-
Contexts are very easy to create. A simple context.Background() will suffice.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
1 reply
-
got it , thank you!
Beta Was this translation helpful? Give feedback.
All reactions
Answer selected by
kyleconroy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment