Skip to main content

Executor

Trait Executor 

Source
pub trait Executor:
    Send
    + Sync
    + 'static {
    // Required methods
    fn capabilities(&self) -> BackendCapabilities;
    fn fetch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        plan: &'life1 QueryPlan,
    ) -> Pin<Box<dyn Future<Output = Result<QueryResult, OrmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        plan: &'life1 WritePlan,
    ) -> Pin<Box<dyn Future<Output = Result<ExecResult, OrmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fetch_raw<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<QueryResult, OrmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_raw<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<u64, OrmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_script<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), OrmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Runs plans and raw statements on a pool or inside a transaction.

Implementations must check plans against capabilities (QueryPlan::check / WritePlan::check) before any I/O and return a capability error instead of ignoring unsupported features.

Required Methods§

Source

fn capabilities(&self) -> BackendCapabilities

Declared capabilities.

Source

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, plan: &'life1 QueryPlan, ) -> Pin<Box<dyn Future<Output = Result<QueryResult, OrmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a read plan.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, plan: &'life1 WritePlan, ) -> Pin<Box<dyn Future<Output = Result<ExecResult, OrmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a write plan.

Source

fn fetch_raw<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<QueryResult, OrmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run raw SQL returning rows. params are bound, never interpolated.

Source

fn execute_raw<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<u64, OrmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run raw SQL returning the affected-row count. params are bound.

Source

fn execute_script<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), OrmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run a multi-statement script without parameters (DDL, migrations).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§