pub trait Db: MaybeSend + MaybeSync {
type Tx<'a>: Tx
where Self: 'a;
// Required method
fn begin(
&self,
) -> impl Future<Output = Result<Self::Tx<'_>, DbError>> + MaybeSend;
}Expand description
A database a request can open a transaction on.
Required Associated Types§
Required Methods§
Sourcefn begin(
&self,
) -> impl Future<Output = Result<Self::Tx<'_>, DbError>> + MaybeSend
fn begin( &self, ) -> impl Future<Output = Result<Self::Tx<'_>, DbError>> + MaybeSend
Open a transaction. The connection is had here, before this returns,
so one that cannot be had fails now rather than at the first statement.
BEGIN is sent here or, by a driver that pipelines, with the first
statement; nothing else is, so SET TRANSACTION may still follow, as
the caller’s first statement. A connection that breaks after this is
reported by the statement that finds out, as
DbError::is_connection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".