-
Notifications
You must be signed in to change notification settings - Fork 26
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
Standalone transactions #369
Comments
Hey, there are other issues with the current closure approach, or maybe misunderstandings on my part.
BTW, the "standalone" transaction is the model implemented by sqlx allowing users to explicitly commit and rollback , so it will probably be familiar to users coming from it. |
For 1., I've outlined the workaround in this comment: #329 (comment). Basically, make the return type of the closure For 2., there is no way of doing that, apart from returning an EdgeDB error. Which adds a point for standalone transactions. And yes, sqlx and postgres, both do it this way. @tiberiusferreira, would you be interested in up-streaming your fork via a PR to this repo? I haven't looked much at the code, but if it implements this API, it would benefit edgedb-rust. |
Oh yeah, for sure. I'll clean it up and make a PR. |
Current transaction API allows little control over how the transaction is retried and requires all work to happen within the transaction's closure.
This means that there are use-cases where more granular access to the transaction would be needed.
In #329 (comment) I've proposed the following API:
Apparently, @tiberiusferreira has already implemented this in their fork: tiberiusferreira@0cc5f57#diff-608add6cc9859de62fac8b605b75549b985354b28530c7c1b07180ccd86fd729R416
Internally, it has been pointed out that this API should be similar across all language bindings, so that we try to rediscover the wheel for each language.
The text was updated successfully, but these errors were encountered: