Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the single transaction restriction from pg.DB #914

Open
jchappelow opened this issue Aug 8, 2024 · 0 comments
Open

remove the single transaction restriction from pg.DB #914

jchappelow opened this issue Aug 8, 2024 · 0 comments
Assignees

Comments

@jchappelow
Copy link
Member

jchappelow commented Aug 8, 2024

The pg.DB type has a fair amount of baggage from it's initial iteration when we did not have the current transaction-passing approach to scoping of queries. In the previous model everything used the top Execute method of the DB type, where the presence of a transaction was kept internal, rather than the Execute method of a transaction type returned from BeginTx et al.

We should pare down the pg.DB type by removing this cruft. I'm pretty certain that there is no longer a need to have pg.DB be a sql.Executor and thus no need to have a singleton transaction tracked inside the pg.DB type.

Making these changes will make the type easier to use and more flexible, such as being able to start multiple write transactions, which is presently blocked if beginWriterTx sees that the db.tx field is already set.

This will involve a fair bit of rewriting, which is why it has not been done yet.

@jchappelow jchappelow self-assigned this Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant