pub trait TextQuery: Sized {
// Required method
fn run<'a, 'b, 'c, C>(
self,
conn: C,
) -> Result<QueryResult<'a, 'b, 'c, Text>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>;
// Provided methods
fn first<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Option<T>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow { ... }
fn first_opt<'a, 'b, 'c: 'b, T, C>(
self,
conn: C,
) -> Result<Option<StdResult<T, FromRowError>>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow { ... }
fn fetch<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Vec<T>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow { ... }
fn fetch_opt<'a, 'b, 'c: 'b, T, C>(
self,
conn: C,
) -> Result<Vec<StdResult<T, FromRowError>>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow { ... }
fn fold<'a, 'b, 'c: 'b, T, U, F, C>(
self,
conn: C,
init: U,
next: F,
) -> Result<U>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow,
F: FnMut(U, T) -> U { ... }
fn fold_opt<'a, 'b, 'c: 'b, T, U, F, C>(
self,
conn: C,
init: U,
next: F,
) -> Result<U>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow,
F: FnMut(U, StdResult<T, FromRowError>) -> U { ... }
fn map<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow,
F: FnMut(T) -> U { ... }
fn map_opt<'a, 'b, 'c: 'b, T, U, F, C>(
self,
conn: C,
map: F,
) -> Result<Vec<U>>
where C: TryInto<ConnMut<'a, 'b, 'c>>,
Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
T: FromRow,
F: FnMut(StdResult<T, FromRowError>) -> U { ... }
}
Expand description
MySql text query.
This trait covers the set of query*
methods on the Queryable
trait.
Please see the corresponding section of the crate level docs for details.
Example:
use mysql::*;
use mysql::prelude::*;
let pool = Pool::new(get_opts())?;
let num: Option<u32> = "SELECT 42".first(&pool)?;
assert_eq!(num, Some(42));
Required Methods§
Provided Methods§
Sourcefn first<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Option<T>>
fn first<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Option<T>>
This methods corresponds to Queryable::query_first
.
Sourcefn first_opt<'a, 'b, 'c: 'b, T, C>(
self,
conn: C,
) -> Result<Option<StdResult<T, FromRowError>>>
fn first_opt<'a, 'b, 'c: 'b, T, C>( self, conn: C, ) -> Result<Option<StdResult<T, FromRowError>>>
Same as TextQuery::first
but useful when you not sure what your schema is.
Sourcefn fetch<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Vec<T>>
fn fetch<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Vec<T>>
This methods corresponds to Queryable::query
.
Sourcefn fetch_opt<'a, 'b, 'c: 'b, T, C>(
self,
conn: C,
) -> Result<Vec<StdResult<T, FromRowError>>>
fn fetch_opt<'a, 'b, 'c: 'b, T, C>( self, conn: C, ) -> Result<Vec<StdResult<T, FromRowError>>>
Same as TextQuery::fetch
but useful when you not sure what your schema is.
Sourcefn fold<'a, 'b, 'c: 'b, T, U, F, C>(
self,
conn: C,
init: U,
next: F,
) -> Result<U>
fn fold<'a, 'b, 'c: 'b, T, U, F, C>( self, conn: C, init: U, next: F, ) -> Result<U>
This methods corresponds to Queryable::query_fold
.
Sourcefn fold_opt<'a, 'b, 'c: 'b, T, U, F, C>(
self,
conn: C,
init: U,
next: F,
) -> Result<U>
fn fold_opt<'a, 'b, 'c: 'b, T, U, F, C>( self, conn: C, init: U, next: F, ) -> Result<U>
Same as TextQuery::fold
but useful when you not sure what your schema is.
Sourcefn map<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>>
fn map<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>>
This methods corresponds to Queryable::query_map
.
Sourcefn map_opt<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>>
fn map_opt<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>>
Same as TextQuery::map
but useful when you not sure what your schema is.
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.