Trait mysql_async::prelude::Queryable
source · pub trait Queryable: Send {
Show 18 methods
// Required methods
fn ping(&mut self) -> BoxFuture<'_, Result<()>>;
fn query_iter<'a, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<QueryResult<'a, 'static, TextProtocol>>>
where Q: AsQuery + 'a;
fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<Statement>>
where Q: AsQuery + 'a;
fn close(&mut self, stmt: Statement) -> BoxFuture<'_, Result<()>>;
fn exec_iter<'a: 's, 's, Q, P>(
&'a mut self,
stmt: Q,
params: P,
) -> BoxFuture<'s, Result<QueryResult<'a, 'static, BinaryProtocol>>>
where Q: StatementLike + 'a,
P: Into<Params>;
fn exec_batch<'a: 'b, 'b, S, P, I>(
&'a mut self,
stmt: S,
params_iter: I,
) -> BoxFuture<'b, Result<()>>
where S: StatementLike + 'b,
I: IntoIterator<Item = P> + Send + 'b,
I::IntoIter: Send,
P: Into<Params> + Send;
// Provided methods
fn query<'a, T, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<Vec<T>>>
where Q: AsQuery + 'a,
T: FromRow + Send + 'static { ... }
fn query_first<'a, T, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<Option<T>>>
where Q: AsQuery + 'a,
T: FromRow + Send + 'static { ... }
fn query_map<'a, T, F, Q, U>(
&'a mut self,
query: Q,
f: F,
) -> BoxFuture<'a, Result<Vec<U>>>
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,
) -> BoxFuture<'a, Result<U>>
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) -> BoxFuture<'a, Result<()>>
where Q: AsQuery + 'a { ... }
fn exec<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<Vec<T>>>
where S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static { ... }
fn exec_first<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<Option<T>>>
where S: StatementLike + 'b,
P: Into<Params> + Send + 'b,
T: FromRow + Send + 'static { ... }
fn exec_map<'a: 'b, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
f: F,
) -> BoxFuture<'b, Result<Vec<U>>>
where 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, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
init: U,
f: F,
) -> BoxFuture<'b, Result<U>>
where 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, 'b, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<()>>
where S: StatementLike + 'b,
P: Into<Params> + Send + 'b { ... }
fn query_stream<'a, T, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<ResultSetStream<'a, 'a, 'static, T, TextProtocol>>>
where T: Unpin + FromRow + Send + 'static,
Q: AsQuery + 'a { ... }
fn exec_stream<'a: 's, 's, T, Q, P>(
&'a mut self,
stmt: Q,
params: P,
) -> BoxFuture<'s, Result<ResultSetStream<'a, 'a, 'static, T, BinaryProtocol>>>
where 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§
sourcefn query_iter<'a, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<QueryResult<'a, 'static, TextProtocol>>>where
Q: AsQuery + 'a,
fn query_iter<'a, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<QueryResult<'a, 'static, TextProtocol>>>where
Q: AsQuery + 'a,
Performs the given query and returns the result.
sourcefn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<Statement>>where
Q: AsQuery + 'a,
fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<Statement>>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
).
sourcefn close(&mut self, stmt: Statement) -> BoxFuture<'_, Result<()>>
fn close(&mut self, stmt: Statement) -> BoxFuture<'_, Result<()>>
Closes the given statement.
Usually there is no need to explicitly close statements
(see. stmt_cache_size
).
sourcefn exec_iter<'a: 's, 's, Q, P>(
&'a mut self,
stmt: Q,
params: P,
) -> BoxFuture<'s, Result<QueryResult<'a, 'static, BinaryProtocol>>>
fn exec_iter<'a: 's, 's, Q, P>( &'a mut self, stmt: Q, params: P, ) -> BoxFuture<'s, Result<QueryResult<'a, 'static, BinaryProtocol>>>
Executes the given statement with given params.
It’ll prepare stmt
, if necessary.
sourcefn exec_batch<'a: 'b, 'b, S, P, I>(
&'a mut self,
stmt: S,
params_iter: I,
) -> BoxFuture<'b, Result<()>>where
S: StatementLike + 'b,
I: IntoIterator<Item = P> + Send + 'b,
I::IntoIter: Send,
P: Into<Params> + Send,
fn exec_batch<'a: 'b, 'b, S, P, I>(
&'a mut self,
stmt: S,
params_iter: I,
) -> BoxFuture<'b, Result<()>>where
S: StatementLike + 'b,
I: IntoIterator<Item = P> + Send + 'b,
I::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§
sourcefn query_first<'a, T, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<Option<T>>>
fn query_first<'a, T, Q>( &'a mut self, query: Q, ) -> BoxFuture<'a, Result<Option<T>>>
sourcefn query_map<'a, T, F, Q, U>(
&'a mut self,
query: Q,
f: F,
) -> BoxFuture<'a, Result<Vec<U>>>
fn query_map<'a, T, F, Q, U>( &'a mut self, query: Q, f: F, ) -> BoxFuture<'a, Result<Vec<U>>>
sourcefn query_fold<'a, T, F, Q, U>(
&'a mut self,
query: Q,
init: U,
f: F,
) -> BoxFuture<'a, Result<U>>
fn query_fold<'a, T, F, Q, U>( &'a mut self, query: Q, init: U, f: F, ) -> BoxFuture<'a, Result<U>>
sourcefn query_drop<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<()>>where
Q: AsQuery + 'a,
fn query_drop<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Result<()>>where
Q: AsQuery + 'a,
Performs the given query and drops the query result.
sourcefn exec<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<Vec<T>>>
fn exec<'a: 'b, 'b, T, S, P>( &'a mut self, stmt: S, params: P, ) -> BoxFuture<'b, Result<Vec<T>>>
sourcefn exec_first<'a: 'b, 'b, T, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<Option<T>>>
fn exec_first<'a: 'b, 'b, T, S, P>( &'a mut self, stmt: S, params: P, ) -> BoxFuture<'b, Result<Option<T>>>
sourcefn exec_map<'a: 'b, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
f: F,
) -> BoxFuture<'b, Result<Vec<U>>>
fn exec_map<'a: 'b, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, f: F, ) -> BoxFuture<'b, Result<Vec<U>>>
sourcefn exec_fold<'a: 'b, 'b, T, S, P, U, F>(
&'a mut self,
stmt: S,
params: P,
init: U,
f: F,
) -> BoxFuture<'b, Result<U>>
fn exec_fold<'a: 'b, 'b, T, S, P, U, F>( &'a mut self, stmt: S, params: P, init: U, f: F, ) -> BoxFuture<'b, Result<U>>
sourcefn exec_drop<'a: 'b, 'b, S, P>(
&'a mut self,
stmt: S,
params: P,
) -> BoxFuture<'b, Result<()>>
fn exec_drop<'a: 'b, 'b, S, P>( &'a mut self, stmt: S, params: P, ) -> BoxFuture<'b, Result<()>>
Executes the given statement and drops the result.
sourcefn query_stream<'a, T, Q>(
&'a mut self,
query: Q,
) -> BoxFuture<'a, Result<ResultSetStream<'a, 'a, 'static, T, TextProtocol>>>
fn query_stream<'a, T, Q>( &'a mut self, query: Q, ) -> BoxFuture<'a, Result<ResultSetStream<'a, 'a, 'static, T, TextProtocol>>>
Returns a stream over the first result set.
Please see QueryResult::stream_and_drop
.
sourcefn exec_stream<'a: 's, 's, T, Q, P>(
&'a mut self,
stmt: Q,
params: P,
) -> BoxFuture<'s, Result<ResultSetStream<'a, 'a, 'static, T, BinaryProtocol>>>
fn exec_stream<'a: 's, 's, T, Q, P>( &'a mut self, stmt: Q, params: P, ) -> BoxFuture<'s, Result<ResultSetStream<'a, 'a, 'static, T, BinaryProtocol>>>
Returns a stream over the first result set.
Please see QueryResult::stream_and_drop
.