Trait mysql_quick::TextQuery

source ·
pub trait TextQuery: Sized {
    // Required method
    fn run<'a, 'b, 'c, C>(
        self,
        conn: C,
    ) -> Result<QueryResult<'a, 'b, 'c, Text>, Error>
       where C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>;

    // Provided methods
    fn first<'a, 'b, 'c, T, C>(self, conn: C) -> Result<Option<T>, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow { ... }
    fn first_opt<'a, 'b, 'c, T, C>(
        self,
        conn: C,
    ) -> Result<Option<Result<T, FromRowError>>, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow { ... }
    fn fetch<'a, 'b, 'c, T, C>(self, conn: C) -> Result<Vec<T>, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow { ... }
    fn fetch_opt<'a, 'b, 'c, T, C>(
        self,
        conn: C,
    ) -> Result<Vec<Result<T, FromRowError>>, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow { ... }
    fn fold<'a, 'b, 'c, T, U, F, C>(
        self,
        conn: C,
        init: U,
        next: F,
    ) -> Result<U, Error>
       where 'c: 'b,
             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, T, U, F, C>(
        self,
        conn: C,
        init: U,
        next: F,
    ) -> Result<U, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow,
             F: FnMut(U, Result<T, FromRowError>) -> U { ... }
    fn map<'a, 'b, 'c, T, U, F, C>(
        self,
        conn: C,
        map: F,
    ) -> Result<Vec<U>, Error>
       where 'c: 'b,
             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, T, U, F, C>(
        self,
        conn: C,
        map: F,
    ) -> Result<Vec<U>, Error>
       where 'c: 'b,
             C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
             T: FromRow,
             F: FnMut(Result<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§

source

fn run<'a, 'b, 'c, C>( self, conn: C, ) -> Result<QueryResult<'a, 'b, 'c, Text>, Error>
where C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,

This methods corresponds to Queryable::query_iter.

Provided Methods§

source

fn first<'a, 'b, 'c, T, C>(self, conn: C) -> Result<Option<T>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow,

This methods corresponds to Queryable::query_first.

source

fn first_opt<'a, 'b, 'c, T, C>( self, conn: C, ) -> Result<Option<Result<T, FromRowError>>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow,

Same as TextQuery::first but useful when you not sure what your schema is.

source

fn fetch<'a, 'b, 'c, T, C>(self, conn: C) -> Result<Vec<T>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow,

This methods corresponds to Queryable::query.

source

fn fetch_opt<'a, 'b, 'c, T, C>( self, conn: C, ) -> Result<Vec<Result<T, FromRowError>>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow,

Same as TextQuery::fetch but useful when you not sure what your schema is.

source

fn fold<'a, 'b, 'c, T, U, F, C>( self, conn: C, init: U, next: F, ) -> Result<U, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow, F: FnMut(U, T) -> U,

This methods corresponds to Queryable::query_fold.

source

fn fold_opt<'a, 'b, 'c, T, U, F, C>( self, conn: C, init: U, next: F, ) -> Result<U, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow, F: FnMut(U, Result<T, FromRowError>) -> U,

Same as TextQuery::fold but useful when you not sure what your schema is.

source

fn map<'a, 'b, 'c, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow, F: FnMut(T) -> U,

This methods corresponds to Queryable::query_map.

source

fn map_opt<'a, 'b, 'c, T, U, F, C>( self, conn: C, map: F, ) -> Result<Vec<U>, Error>
where 'c: 'b, C: TryInto<ConnMut<'a, 'b, 'c>>, Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, T: FromRow, F: FnMut(Result<T, FromRowError>) -> U,

Same as TextQuery::map but useful when you not sure what your schema is.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Q> TextQuery for Q
where Q: AsRef<str>,