Trait mysql::prelude::Queryable [−][src]
pub trait Queryable {}Show methods
fn query_iter<Q: AsRef<str>>(
&mut self,
query: Q
) -> Result<QueryResult<'_, '_, '_, Text>>; fn prep<Q: AsRef<str>>(&mut self, query: Q) -> Result<Statement>; fn close(&mut self, stmt: Statement) -> Result<()>; fn exec_iter<S, P>(
&mut self,
stmt: S,
params: P
) -> Result<QueryResult<'_, '_, '_, Binary>>
where
S: AsStatement,
P: Into<Params>; fn query<T, Q>(&mut self, query: Q) -> Result<Vec<T>>
where
Q: AsRef<str>,
T: FromRow, { ... } fn query_opt<T, Q>(
&mut self,
query: Q
) -> Result<Vec<StdResult<T, FromRowError>>>
where
Q: AsRef<str>,
T: FromRow, { ... } fn query_first<T, Q>(&mut self, query: Q) -> Result<Option<T>>
where
Q: AsRef<str>,
T: FromRow, { ... } fn query_first_opt<T, Q>(
&mut self,
query: Q
) -> Result<Option<StdResult<T, FromRowError>>>
where
Q: AsRef<str>,
T: FromRow, { ... } fn query_map<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
where
Q: AsRef<str>,
T: FromRow,
F: FnMut(T) -> U, { ... } fn query_map_opt<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>>
where
Q: AsRef<str>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U, { ... } fn query_fold<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U>
where
Q: AsRef<str>,
T: FromRow,
F: FnMut(U, T) -> U, { ... } fn query_fold_opt<T, F, Q, U>(
&mut self,
query: Q,
init: U,
f: F
) -> Result<U>
where
Q: AsRef<str>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U, { ... } fn query_drop<Q>(&mut self, query: Q) -> Result<()>
where
Q: AsRef<str>, { ... } fn exec_batch<S, P, I>(&mut self, stmt: S, params: I) -> Result<()>
where
Self: Sized,
S: AsStatement,
P: Into<Params>,
I: IntoIterator<Item = P>, { ... } fn exec<T, S, P>(&mut self, stmt: S, params: P) -> Result<Vec<T>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow, { ... } fn exec_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Vec<StdResult<T, FromRowError>>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow, { ... } fn exec_first<T, S, P>(&mut self, stmt: S, params: P) -> Result<Option<T>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow, { ... } fn exec_first_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Option<StdResult<T, FromRowError>>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow, { ... } fn exec_map<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F
) -> Result<Vec<U>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(T) -> U, { ... } fn exec_map_opt<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F
) -> Result<Vec<U>>
where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U, { ... } fn exec_fold<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F
) -> Result<U>
where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(U, T) -> U, { ... } fn exec_fold_opt<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F
) -> Result<U>
where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U, { ... } fn exec_drop<S, P>(&mut self, stmt: S, params: P) -> Result<()>
where
S: AsStatement,
P: Into<Params>, { ... }
Expand description
Queryable object.
Required methods
fn query_iter<Q: AsRef<str>>(
&mut self,
query: Q
) -> Result<QueryResult<'_, '_, '_, Text>>
fn query_iter<Q: AsRef<str>>(
&mut self,
query: Q
) -> Result<QueryResult<'_, '_, '_, Text>>
Perfoms text query.
Prepares the given query
as a prepared statement.
This function will close the given statement on the server side.
fn exec_iter<S, P>(
&mut self,
stmt: S,
params: P
) -> Result<QueryResult<'_, '_, '_, Binary>> where
S: AsStatement,
P: Into<Params>,
fn exec_iter<S, P>(
&mut self,
stmt: S,
params: P
) -> Result<QueryResult<'_, '_, '_, Binary>> where
S: AsStatement,
P: Into<Params>,
Executes the given stmt
with the given params
.
Provided methods
Performs text query and collects the first result set.
Same as Queryable::query
but useful when you not sure what your schema is.
Performs text query and returns the first row of the first result set.
fn query_first_opt<T, Q>(
&mut self,
query: Q
) -> Result<Option<StdResult<T, FromRowError>>> where
Q: AsRef<str>,
T: FromRow,
fn query_first_opt<T, Q>(
&mut self,
query: Q
) -> Result<Option<StdResult<T, FromRowError>>> where
Q: AsRef<str>,
T: FromRow,
Same as Queryable::query_first
but useful when you not sure what your schema is.
Performs text query and maps each row of the first result set.
fn query_map_opt<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>> where
Q: AsRef<str>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U,
fn query_map_opt<T, F, Q, U>(&mut self, query: Q, f: F) -> Result<Vec<U>> where
Q: AsRef<str>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U,
Same as Queryable::query_map
but useful when you not sure what your schema is.
Performs text query and folds the first result set to a single value.
fn query_fold_opt<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U> where
Q: AsRef<str>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U,
fn query_fold_opt<T, F, Q, U>(&mut self, query: Q, init: U, f: F) -> Result<U> where
Q: AsRef<str>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U,
Same as Queryable::query_fold
but useful when you not sure what your schema is.
Performs text query and drops the query result.
fn exec_batch<S, P, I>(&mut self, stmt: S, params: I) -> Result<()> where
Self: Sized,
S: AsStatement,
P: Into<Params>,
I: IntoIterator<Item = P>,
fn exec_batch<S, P, I>(&mut self, stmt: S, params: I) -> Result<()> where
Self: Sized,
S: AsStatement,
P: Into<Params>,
I: IntoIterator<Item = P>,
Prepares the given statement, and executes it with each item in the given params iterator.
Executes the given stmt
and collects the first result set.
fn exec_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Vec<StdResult<T, FromRowError>>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
fn exec_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Vec<StdResult<T, FromRowError>>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
Same as Queryable::exec
but useful when you not sure what your schema is.
fn exec_first<T, S, P>(&mut self, stmt: S, params: P) -> Result<Option<T>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
fn exec_first<T, S, P>(&mut self, stmt: S, params: P) -> Result<Option<T>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
Executes the given stmt
and returns the first row of the first result set.
fn exec_first_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Option<StdResult<T, FromRowError>>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
fn exec_first_opt<T, S, P>(
&mut self,
stmt: S,
params: P
) -> Result<Option<StdResult<T, FromRowError>>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
Same as Queryable::exec_first
but useful when you not sure what your schema is.
Executes the given stmt
and maps each row of the first result set.
fn exec_map_opt<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F
) -> Result<Vec<U>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U,
fn exec_map_opt<T, S, P, F, U>(
&mut self,
stmt: S,
params: P,
f: F
) -> Result<Vec<U>> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U,
Same as Queryable::exec_map
but useful when you not sure what your schema is.
Executes the given stmt
and folds the first result set to a signel value.
fn exec_fold_opt<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F
) -> Result<U> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U,
fn exec_fold_opt<T, S, P, U, F>(
&mut self,
stmt: S,
params: P,
init: U,
f: F
) -> Result<U> where
S: AsStatement,
P: Into<Params>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U,
Same as Queryable::exec_fold
but useful when you not sure what your schema is.