diff --git a/src/transaction.rs b/src/transaction.rs index abc71ea..253f4c5 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,4 +1,5 @@ use futures::{StreamExt, TryStreamExt}; +use sqlx::Error; use tracing::Instrument; impl<'c, DB> crate::Transaction<'c, DB> @@ -15,6 +16,16 @@ where attributes: self.attributes.clone(), } } + + /// Commits this transaction or savepoint. + pub async fn commit(self) -> Result<(), Error> { + self.inner.commit().await + } + + /// Aborts this transaction or savepoint. + pub async fn rollback(self) -> Result<(), Error> { + self.inner.rollback().await + } } /// Implements `sqlx::Executor` for a mutable reference to a tracing-instrumented transaction.