pub trait RelationalBackend: Send + Sync {
type Tx<'a>: RelationalTx + 'a
where Self: 'a;
// Required methods
fn backend(&self) -> &str;
fn version(&self) -> &str;
fn dialect(&self) -> Dialect;
fn execute(
&self,
sql: &str,
params: &[Value],
) -> impl Future<Output = Result<u64, RelError>> + Send;
fn query(
&self,
sql: &str,
params: &[Value],
) -> impl Future<Output = Result<Vec<Row>, RelError>> + Send;
fn begin(
&self,
isolation: Isolation,
) -> impl Future<Output = Result<Self::Tx<'_>, RelError>> + Send;
}Expand description
A relational database, as small as it can be.
Statements are written in the backend’s own Dialect; parameters are positional and written
as that dialect writes them ($1 for PostgreSQL). Nothing here translates SQL.
Required Associated Types§
Sourcetype Tx<'a>: RelationalTx + 'a
where
Self: 'a
type Tx<'a>: RelationalTx + 'a where Self: 'a
A transaction on this backend. Dropping it without commit rolls it back.
Required Methods§
Sourcefn execute(
&self,
sql: &str,
params: &[Value],
) -> impl Future<Output = Result<u64, RelError>> + Send
fn execute( &self, sql: &str, params: &[Value], ) -> impl Future<Output = Result<u64, RelError>> + Send
Run a statement that returns no rows; the result is the number of rows affected.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".