pub trait Backend: Executor {
// Required method
fn begin<'life0, 'async_trait>(
&'life0 self,
isolation: Option<IsolationLevel>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn read_parameter_count(
&self,
_plan: &QueryPlan,
) -> Result<Option<usize>, OrmError> { ... }
fn begin_schema<'life0, 'async_trait>(
&'life0 self,
transactional: bool,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A connection pool that can open transactions.
Required Methods§
Sourcefn begin<'life0, 'async_trait>(
&'life0 self,
isolation: Option<IsolationLevel>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin<'life0, 'async_trait>(
&'life0 self,
isolation: Option<IsolationLevel>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin a transaction on a dedicated connection.
isolation is validated against
BackendCapabilities::isolation_levels before any I/O.
Provided Methods§
Sourcefn read_parameter_count(
&self,
_plan: &QueryPlan,
) -> Result<Option<usize>, OrmError>
fn read_parameter_count( &self, _plan: &QueryPlan, ) -> Result<Option<usize>, OrmError>
Count compiled read parameters without database I/O.
Args: _plan: Complete read plan whose existing binds consume capacity.
Returns: Exact compiled bind count, or None when the backend cannot report it. SQL prefetch requires this contract for bounded batching.
§Errors
Capability or plan compilation errors.
Sourcefn begin_schema<'life0, 'async_trait>(
&'life0 self,
transactional: bool,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn begin_schema<'life0, 'async_trait>(
&'life0 self,
transactional: bool,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Transaction>, OrmError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Connection for a schema migration.
When transactional is true this is a transaction, same as
begin with no isolation override. SQLite turns
PRAGMA foreign_keys off on that connection before BEGIN (the
pragma is a no-op inside a transaction), runs PRAGMA foreign_key_check
before commit, and restores the previous pragma value afterwards.
Other backends ignore the SQLite-specific work.
§Errors
The default implementation has no way to hold a connection outside a
transaction, so transactional == false fails with a capability error
instead of silently handing back a transaction.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".