QueryExecutor

Trait QueryExecutor 

Source
pub trait QueryExecutor: Sized {
    // Required methods
    fn query<R, A>(
        self,
        query: impl AsRef<str> + Send,
        arguments: &A,
    ) -> impl Future<Output = Result<Vec<R>, Error>> + Send
       where A: QueryArgs,
             R: QueryResult + Send;
    fn query_verbose<R, A>(
        self,
        query: impl AsRef<str> + Send,
        arguments: &A,
    ) -> impl Future<Output = Result<ResultVerbose<Vec<R>>, Error>> + Send
       where A: QueryArgs,
             R: QueryResult + Send;
    fn query_single<R, A>(
        self,
        query: impl AsRef<str> + Send,
        arguments: &A,
    ) -> impl Future<Output = Result<Option<R>, Error>> + Send
       where A: QueryArgs,
             R: QueryResult + Send;
    fn query_required_single<R, A>(
        self,
        query: impl AsRef<str> + Send,
        arguments: &A,
    ) -> impl Future<Output = Result<R, Error>> + Send
       where A: QueryArgs,
             R: QueryResult + Send;
    fn query_json(
        self,
        query: &str,
        arguments: &impl QueryArgs,
    ) -> impl Future<Output = Result<Json, Error>> + Send;
    fn query_single_json(
        self,
        query: &str,
        arguments: &impl QueryArgs,
    ) -> impl Future<Output = Result<Option<Json>, Error>> + Send;
    fn query_required_single_json(
        self,
        query: &str,
        arguments: &impl QueryArgs,
    ) -> impl Future<Output = Result<Json, Error>>;
    fn execute<A>(
        self,
        query: &str,
        arguments: &A,
    ) -> impl Future<Output = Result<(), Error>> + Send
       where A: QueryArgs;
}
Expand description

Abstracts over different query executors In particular &Client and &mut Transaction

Required Methods§

Source

fn query<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<Vec<R>, Error>> + Send
where A: QueryArgs, R: QueryResult + Send,

Source

fn query_verbose<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<ResultVerbose<Vec<R>>, Error>> + Send
where A: QueryArgs, R: QueryResult + Send,

Source

fn query_single<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<Option<R>, Error>> + Send
where A: QueryArgs, R: QueryResult + Send,

Source

fn query_required_single<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<R, Error>> + Send
where A: QueryArgs, R: QueryResult + Send,

Source

fn query_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Json, Error>> + Send

Source

fn query_single_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Option<Json>, Error>> + Send

Source

fn query_required_single_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Json, Error>>

Source

fn execute<A>( self, query: &str, arguments: &A, ) -> impl Future<Output = Result<(), Error>> + Send
where A: QueryArgs,

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<T: DerefMut<Target = Transaction>> QueryExecutor for &mut T

Source§

fn query<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<Vec<R>, Error>>
where A: QueryArgs, R: QueryResult,

Source§

fn query_verbose<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<ResultVerbose<Vec<R>>, Error>> + Send
where A: QueryArgs, R: QueryResult + Send,

Source§

fn query_single<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<Option<R>, Error>>
where A: QueryArgs, R: QueryResult + Send,

Source§

fn query_required_single<R, A>( self, query: impl AsRef<str> + Send, arguments: &A, ) -> impl Future<Output = Result<R, Error>>
where A: QueryArgs, R: QueryResult + Send,

Source§

fn query_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Json, Error>>

Source§

fn query_single_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Option<Json>, Error>>

Source§

fn query_required_single_json( self, query: &str, arguments: &impl QueryArgs, ) -> impl Future<Output = Result<Json, Error>>

Source§

fn execute<A>( self, query: &str, arguments: &A, ) -> impl Future<Output = Result<(), Error>>
where A: QueryArgs,

Implementors§