Skip to main content

Adapter

Trait Adapter 

Source
pub trait Adapter: Send + Sync {
    // Required methods
    fn execute(
        &self,
        query: &str,
        params: &[Parameter],
    ) -> Result<Rows, DactylError>;
    fn execute_raw(
        &self,
        query: &str,
        params: &[Parameter],
    ) -> Result<u64, DactylError>;
    fn execute_batch(
        &self,
        statements: &[Statement],
    ) -> Result<Vec<Rows>, DactylError>;
}
Expand description

Internal trait every adapter implements.

Adapters are constructed per call from [crate::build_adapter] and dropped at the end of the call — there is no shared cache, so implementations do not need to be Sync across calls. The trait is kept Send + Sync so a caller could, if it chose to, hold an adapter across awaited points.

Required Methods§

Source

fn execute( &self, query: &str, params: &[Parameter], ) -> Result<Rows, DactylError>

Execute any SQL statement (read or write) and return its rows.

Parameters are bound by the adapter — never interpolated into query.

Source

fn execute_raw( &self, query: &str, params: &[Parameter], ) -> Result<u64, DactylError>

Execute a raw schema/DDL/migration operation and return affected rows.

Source

fn execute_batch( &self, statements: &[Statement], ) -> Result<Vec<Rows>, DactylError>

Execute an atomic batch of statements.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§