pub trait Queryable: Send {
Show 18 methods // Required methods fn ping( &mut self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn query_iter<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<QueryResult<'a, 'static, TextProtocol>, Error>> + Send + 'a>> where Q: AsQuery + 'a; fn prep<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Statement, Error>> + Send + 'a>> where Q: AsQuery + 'a; fn close( &mut self, stmt: Statement ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn exec_iter<'a, 's, Q, P>( &'a mut self, stmt: Q, params: P ) -> Pin<Box<dyn Future<Output = Result<QueryResult<'a, 'static, BinaryProtocol>, Error>> + Send + 's>> where 'a: 's, Q: StatementLike + 'a, P: Into<Params>; fn exec_batch<'a, 'b, S, P, I>( &'a mut self, stmt: S, params_iter: I ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, I: IntoIterator<Item = P> + Send + 'b, <I as IntoIterator>::IntoIter: Send, P: Into<Params> + Send; // Provided methods fn query<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'a>> where Q: AsQuery + 'a, T: FromRow + Send + 'static { ... } fn query_first<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'a>> where Q: AsQuery + 'a, T: FromRow + Send + 'static { ... } fn query_map<'a, T, F, Q, U>( &'a mut self, query: Q, f: F ) -> Pin<Box<dyn Future<Output = Result<Vec<U>, Error>> + Send + 'a>> where Q: AsQuery + 'a, T: FromRow + Send + 'static, F: FnMut(T) -> U + Send + 'a, U: Send { ... } fn query_fold<'a, T, F, Q, U>( &'a mut self, query: Q, init: U, f: F ) -> Pin<Box<dyn Future<Output = Result<U, Error>> + Send + 'a>> where Q: AsQuery + 'a, T: FromRow + Send + 'static, F: FnMut(U, T) -> U + Send + 'a, U: Send + 'a { ... } fn query_drop<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> where Q: AsQuery + 'a { ... } fn exec<'a, 'b, T, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static { ... } fn exec_first<'a, 'b, T, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static { ... } fn exec_map<'a, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, f: F ) -> Pin<Box<dyn Future<Output = Result<Vec<U>, Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static, F: FnMut(T) -> U + Send + 'a, U: Send + 'a { ... } fn exec_fold<'a, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, init: U, f: F ) -> Pin<Box<dyn Future<Output = Result<U, Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static, F: FnMut(U, T) -> U + Send + 'a, U: Send + 'a { ... } fn exec_drop<'a, 'b, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'b>> where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b { ... } fn query_stream<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<ResultSetStream<'a, 'a, 'static, T, TextProtocol>, Error>> + Send + 'a>> where T: Unpin + FromRow + Send + 'static, Q: AsQuery + 'a { ... } fn exec_stream<'a, 's, T, Q, P>( &'a mut self, stmt: Q, params: P ) -> Pin<Box<dyn Future<Output = Result<ResultSetStream<'a, 'a, 'static, T, BinaryProtocol>, Error>> + Send + 's>> where 'a: 's, T: Unpin + FromRow + Send + 'static, Q: StatementLike + 'a, P: Into<Params> + Send + 's { ... }
}
Expand description

Methods of this trait are used to execute database queries.

Conn is a Queryable as well as Transaction.

Required Methods§

source

fn ping( &mut self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Executes COM_PING.

source

fn query_iter<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<QueryResult<'a, 'static, TextProtocol>, Error>> + Send + 'a>>
where Q: AsQuery + 'a,

Performs the given query and returns the result.

source

fn prep<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Statement, Error>> + Send + 'a>>
where Q: AsQuery + 'a,

Prepares the given statement.

Note, that Statement will exist only in the context of this queryable.

Also note, that this call may close the least recently used statement if statement cache is at its capacity (see. stmt_cache_size).

source

fn close( &mut self, stmt: Statement ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Closes the given statement.

Usually there is no need to explicitly close statements (see. stmt_cache_size).

source

fn exec_iter<'a, 's, Q, P>( &'a mut self, stmt: Q, params: P ) -> Pin<Box<dyn Future<Output = Result<QueryResult<'a, 'static, BinaryProtocol>, Error>> + Send + 's>>
where 'a: 's, Q: StatementLike + 'a, P: Into<Params>,

Executes the given statement with given params.

It’ll prepare stmt, if necessary.

source

fn exec_batch<'a, 'b, S, P, I>( &'a mut self, stmt: S, params_iter: I ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, I: IntoIterator<Item = P> + Send + 'b, <I as IntoIterator>::IntoIter: Send, P: Into<Params> + Send,

Executes the given statement for each item in the given params iterator.

It’ll prepare stmt (once), if necessary.

Provided Methods§

source

fn query<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'a>>
where Q: AsQuery + 'a, T: FromRow + Send + 'static,

Performs the given query and collects the first result set.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn query_first<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'a>>
where Q: AsQuery + 'a, T: FromRow + Send + 'static,

Performs the given query and returns the first row of the first result set.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn query_map<'a, T, F, Q, U>( &'a mut self, query: Q, f: F ) -> Pin<Box<dyn Future<Output = Result<Vec<U>, Error>> + Send + 'a>>
where Q: AsQuery + 'a, T: FromRow + Send + 'static, F: FnMut(T) -> U + Send + 'a, U: Send,

Performs the given query and maps each row of the first result set.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn query_fold<'a, T, F, Q, U>( &'a mut self, query: Q, init: U, f: F ) -> Pin<Box<dyn Future<Output = Result<U, Error>> + Send + 'a>>
where Q: AsQuery + 'a, T: FromRow + Send + 'static, F: FnMut(U, T) -> U + Send + 'a, U: Send + 'a,

Performs the given query and folds the first result set to a single value.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn query_drop<'a, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
where Q: AsQuery + 'a,

Performs the given query and drops the query result.

source

fn exec<'a, 'b, T, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static,

Executes the given statement and collects the first result set.

It’ll prepare stmt, if necessary.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn exec_first<'a, 'b, T, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static,

Executes the given statement and returns the first row of the first result set.

It’ll prepare stmt, if necessary.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn exec_map<'a, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, f: F ) -> Pin<Box<dyn Future<Output = Result<Vec<U>, Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static, F: FnMut(T) -> U + Send + 'a, U: Send + 'a,

Executes the given stmt and maps each row of the first result set.

It’ll prepare stmt, if necessary.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn exec_fold<'a, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, init: U, f: F ) -> Pin<Box<dyn Future<Output = Result<U, Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b, T: FromRow + Send + 'static, F: FnMut(U, T) -> U + Send + 'a, U: Send + 'a,

Executes the given stmt and folds the first result set to a signel value.

It’ll prepare stmt, if necessary.

Conversion

This stream will convert each row into T using [FromRow] implementation. If the row type is unknown please use the [Row] type for T to make this conversion infallible.

source

fn exec_drop<'a, 'b, S, P>( &'a mut self, stmt: S, params: P ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'b>>
where 'a: 'b, S: StatementLike + 'b, P: Into<Params> + Send + 'b,

Executes the given statement and drops the result.

source

fn query_stream<'a, T, Q>( &'a mut self, query: Q ) -> Pin<Box<dyn Future<Output = Result<ResultSetStream<'a, 'a, 'static, T, TextProtocol>, Error>> + Send + 'a>>
where T: Unpin + FromRow + Send + 'static, Q: AsQuery + 'a,

Returns a stream over the first result set.

Please see QueryResult::stream_and_drop.

source

fn exec_stream<'a, 's, T, Q, P>( &'a mut self, stmt: Q, params: P ) -> Pin<Box<dyn Future<Output = Result<ResultSetStream<'a, 'a, 'static, T, BinaryProtocol>, Error>> + Send + 's>>
where 'a: 's, T: Unpin + FromRow + Send + 'static, Q: StatementLike + 'a, P: Into<Params> + Send + 's,

Returns a stream over the first result set.

Please see QueryResult::stream_and_drop.

Object Safety§

This trait is not object safe.

Implementors§