Trait mysql::prelude::Queryable

source ·
pub trait Queryable {
Show 23 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§

source

fn query_iter<Q: AsRef<str>>(
&mut self,
query: Q
) -> Result<QueryResult<'_, '_, '_, Text>>

Perfoms text query.

source

fn prep<Q: AsRef<str>>(&mut self, query: Q) -> Result<Statement>

Prepares the given query as a prepared statement.

source

fn close(&mut self, stmt: Statement) -> Result<()>

This function will close the given statement on the server side.

source

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§

source

fn query<T, Q>(&mut self, query: Q) -> Result<Vec<T>>where
Q: AsRef<str>,
T: FromRow,

Performs text query and collects the first result set.

source

fn query_opt<T, Q>(
&mut self,
query: Q
) -> Result<Vec<StdResult<T, FromRowError>>>where
Q: AsRef<str>,
T: FromRow,

Same as Queryable::query but useful when you not sure what your schema is.

source

fn query_first<T, Q>(&mut self, query: Q) -> Result<Option<T>>where
Q: AsRef<str>,
T: FromRow,

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

source

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.

source

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,

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

source

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.

source

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,

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

source

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.

source

fn query_drop<Q>(&mut self, query: Q) -> Result<()>where
Q: AsRef<str>,

Performs text query and drops the query result.

source

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.

source

fn exec<T, S, P>(&mut self, stmt: S, params: P) -> Result<Vec<T>>where
S: AsStatement,
P: Into<Params>,
T: FromRow,

Executes the given stmt and collects the first result set.

source

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.

source

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.

source

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.

source

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,

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

source

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.

source

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,

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

source

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.

source

fn exec_drop<S, P>(&mut self, stmt: S, params: P) -> Result<()>where
S: AsStatement,
P: Into<Params>,

Executes the given stmt and drops the result.

Implementors§