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

Raw transactions #373

Merged
merged 3 commits into from
Jan 31, 2025
Merged

Raw transactions #373

merged 3 commits into from
Jan 31, 2025

Conversation

aljazerzen
Copy link
Contributor

@aljazerzen aljazerzen commented Jan 10, 2025

Closes #369
Supersedes #370

Adds the following API:

impl Client {
    fn transaction() -> Result<StandaloneTransaction, Error>;

    fn within_transaction(body: FnMut(RetryingTransaction) -> Future<...>) -> Result<...>;
}

impl Drop for StandaloneTransaction {
    fn drop(&mut self) {
        self.rollback();
    }
}

Both RetryingTransaction and StandaloneTransaction implement DerefMut<Target = Transaction>, which gives access to all query_* and execute methods that reside on the Transaction.

@aljazerzen
Copy link
Contributor Author

Docs screenshots:

image
image
image
image

@aljazerzen aljazerzen force-pushed the standalone-transactions branch from 32cc4da to 0e0ba31 Compare January 10, 2025 16:02
@aljazerzen aljazerzen requested review from 1st1 and msullivan January 10, 2025 16:03
@aljazerzen aljazerzen changed the title StandaloneTransaction Raw transactions Jan 15, 2025
@tiberiusferreira
Copy link

I'd love to see this merged. Any chance this will be on the next release?

@aljazerzen
Copy link
Contributor Author

Yeah, possible. It is basically done.

But @tiberiusferreira, can you take a look at this?

#369 (comment)

@aljazerzen aljazerzen force-pushed the standalone-transactions branch from 7050376 to 1c1affa Compare January 31, 2025 10:38
@aljazerzen aljazerzen merged commit 6e2c611 into master Jan 31, 2025
4 checks passed
@aljazerzen aljazerzen deleted the standalone-transactions branch January 31, 2025 11:55
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

Successfully merging this pull request may close these issues.

Standalone transactions
2 participants