-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix handling of transactions with explicit isolation level #3
Conversation
Hey 👋 Thanks! Could we add a test case for isolation level? |
I tried adding the tests from the upstream Kysely project, but it looks like the You're more familiar with the nuts and bolts of Kysely itself—is there a simple workaround? More specifically: is there a reason we're performing the transaction handling logic in the |
Its a hack around Postgres.js's limitations (no single connection getter, transaction API not suitable for Kysely - we have no control over commit/rollback) and how Kysely is built around these parts. The lifecycle of a transaction in Kysely ~is:
|
Mirroring what the vanilla Postgres driver does here: https://github.com/kysely-org/kysely/blob/a826cede4007211ec670bfe094de8acdddbbe1cb/src/dialect/postgres/postgres-driver.ts#L58-L66
Tests pass! Let me know if there's anything else you'd like addressed as part of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
First of all, super excited for this plugin! Been wanting to use Kysely with Postgres.js for a while. Thanks for getting it started!
Looks like the current implementation doesn't support transactions with specific isolation levels. Fix that by mirroring what the vanilla Postgres driver does here: https://github.com/kysely-org/kysely/blob/a826cede4007211ec670bfe094de8acdddbbe1cb/src/dialect/postgres/postgres-driver.ts#L58-L66