Trait Executor

Source
pub trait Executor: Send + Sync {
    type Transaction<'a>: 'a + Transaction<'a>
       where Self: 'a;

    // Required methods
    fn name() -> &'static str;
    fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
        params: &'life2 [&'life3 Vec<u8>],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyValue>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn txn_executor<'a, 'async_trait>(
        &'a mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Transaction<'a>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;

    // Provided method
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
        params: &'life2 [&'life3 Vec<u8>],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Query executor for rds. It can execute queries or generate a transaction executor.

Required Associated Types§

Source

type Transaction<'a>: 'a + Transaction<'a> where Self: 'a

Required Methods§

Source

fn name() -> &'static str

Source

fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, query: &'life1 str, params: &'life2 [&'life3 Vec<u8>], ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn txn_executor<'a, 'async_trait>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::Transaction<'a>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Provided Methods§

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, query: &'life1 str, params: &'life2 [&'life3 Vec<u8>], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Some queries don’t need to return any result, such as DELETE.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Executor for Arc<Pool<MySql>>

Source§

type Transaction<'a> = MySqlTxnClient where Self: 'a

Source§

fn name() -> &'static str

Source§

fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, raw_query: &'life1 str, params: &'life2 [&'life3 Vec<u8>], ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, raw_query: &'life1 str, params: &'life2 [&'life3 Vec<u8>], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn txn_executor<'a, 'async_trait>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::Transaction<'a>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Implementors§

Source§

impl Executor for PgClient

Source§

type Transaction<'a> = PgTxnClient<'a> where Self: 'a