Improve APIs for using transactions #1230
Unanswered
belak
asked this question in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been mocking up some changes to the generated interfaces to make using transactions easier, but I wanted to get opinions before I spend the time implementing it. The below snippets are using pgx, but it should translate similarly to database/sql as well.
Here is the main problem I've been running into - before I started switching to sqlc, I attached all the generated methods to the DBTX, but because of the possibility of using prepared queries with database/sql, this is not possible - in sqlc there is a concrete Queries type which all of them are attached to. There could be some unexported generated types, but that seems less than ideal. Do you have any ideas to solve that? Is this even worth pursuing? Are there better ways/APIs to make transactions easier to use?
Beta Was this translation helpful? Give feedback.
All reactions