pub trait Transaction: QueryExecutor {
type Nested<'a>: Transaction<Error = Self::Error, Row = Self::Row> + 'a
where Self: 'a;
// Required methods
fn transaction(
&mut self,
) -> impl Future<Output = Result<Self::Nested<'_>, Self::Error>> + Send;
fn commit(self) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn rollback(self) -> impl Future<Output = Result<(), Self::Error>> + Send;
}Expand description
Trait for a database transaction.
Extends QueryExecutor with commit/rollback and nested transaction (savepoint) support.
Dropping without calling commit() should rollback the transaction.
Required Associated Types§
type Nested<'a>: Transaction<Error = Self::Error, Row = Self::Row> + 'a where Self: 'a
Required Methods§
Sourcefn transaction(
&mut self,
) -> impl Future<Output = Result<Self::Nested<'_>, Self::Error>> + Send
fn transaction( &mut self, ) -> impl Future<Output = Result<Self::Nested<'_>, Self::Error>> + Send
Begin a nested transaction (savepoint).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.