pub trait Transaction {
type Error: Error;
type Permit;
// Required methods
fn begin(&self) -> impl Future<Output = Result<Self::Permit, Self::Error>>;
fn rollback(
&self,
permit: Self::Permit,
) -> impl Future<Output = Result<(), Self::Error>>;
fn commit(
&self,
permit: Self::Permit,
) -> impl Future<Output = Result<(), Self::Error>>;
}Expand description
Traits to implement database transaction provider.
To guard against sharing transactions unknowingly across unrelated database queries, a concept of a “permit” was introduced which does not protect from misuse but helps to make “holding” a transaction explicit.
Required Associated Types§
Required Methods§
Sourcefn begin(&self) -> impl Future<Output = Result<Self::Permit, Self::Error>>
fn begin(&self) -> impl Future<Output = Result<Self::Permit, Self::Error>>
Begins a transaction.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl Transaction for SqliteStore
Available on crate feature sqlite only.
impl Transaction for SqliteStore
Available on crate feature
sqlite only.type Error = SqliteError
type Permit = TransactionPermit
Source§impl<E> Transaction for SqliteSpacesStore<E>
Available on crate features spaces and sqlite only.
impl<E> Transaction for SqliteSpacesStore<E>
Available on crate features
spaces and sqlite only.