Executor

Trait Executor 

Source
pub trait Executor: Send + Sized {
    type Driver: Driver;

    // Required methods
    fn driver(&self) -> &Self::Driver;
    fn prepare(
        &mut self,
        query: String,
    ) -> impl Future<Output = Result<Query<Self::Driver>>> + Send;
    fn run(
        &mut self,
        query: Query<Self::Driver>,
    ) -> impl Stream<Item = Result<QueryResult>> + Send;

    // Provided methods
    fn fetch<'s>(
        &'s mut self,
        query: Query<Self::Driver>,
    ) -> impl Stream<Item = Result<RowLabeled>> + Send + 's { ... }
    fn execute(
        &mut self,
        query: Query<Self::Driver>,
    ) -> impl Future<Output = Result<RowsAffected>> + Send { ... }
    fn append<'a, E, It>(
        &mut self,
        entities: It,
    ) -> impl Future<Output = Result<RowsAffected>> + Send
       where E: Entity + 'a,
             It: IntoIterator<Item = &'a E> + Send { ... }
}

Required Associated Types§

Required Methods§

Source

fn driver(&self) -> &Self::Driver

Source

fn prepare( &mut self, query: String, ) -> impl Future<Output = Result<Query<Self::Driver>>> + Send

Source

fn run( &mut self, query: Query<Self::Driver>, ) -> impl Stream<Item = Result<QueryResult>> + Send

General method to send any query and return any result type (either row or count)

Provided Methods§

Source

fn fetch<'s>( &'s mut self, query: Query<Self::Driver>, ) -> impl Stream<Item = Result<RowLabeled>> + Send + 's

Execute the query and returns the rows.

Source

fn execute( &mut self, query: Query<Self::Driver>, ) -> impl Future<Output = Result<RowsAffected>> + Send

Execute the query and return the total number of rows affected.

Source

fn append<'a, E, It>( &mut self, entities: It, ) -> impl Future<Output = Result<RowsAffected>> + Send
where E: Entity + 'a, It: IntoIterator<Item = &'a E> + Send,

Append entities to a table. Defaults to insert query for drivers that do not support this feature.

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.

Implementors§