[][src]Struct sqlx::query::Map

#[must_use = "query must be executed to affect database"]pub struct Map<'q, DB, F> where
    DB: Database
{ /* fields omitted */ }

SQL query that will map its results to owned Rust types.

Returned by Query::try_map, query!(), etc. Has most of the same methods as Query but the return types are changed to reflect the mapping. However, there is no equivalent of Query::execute as it doesn't make sense to map the result type and then ignore it.

Query::bind is also omitted; stylistically we recommend placing your .bind() calls before .try_map() anyway.

Methods

impl<'q, DB, F> Map<'q, DB, F> where
    DB: Database,
    F: TryMapRow<DB>,
    Query<'q, DB>: Execute<'q, DB>, 
[src]

pub fn fetch<'e, E>(
    self,
    executor: E
) -> impl Unpin + Stream<Item = Result<<F as TryMapRow<DB>>::Output, Error>> + 'e where
    'e: 'q,
    'q: 'e,
    E: RefExecutor<'e, Database = DB> + 'e,
    F: 'e,
    <F as TryMapRow<DB>>::Output: 'e, 
[src]

Execute the query and get a [Stream] of the results, returning our mapped type.

pub async fn fetch_optional<'e, E>(
    self,
    executor: E
) -> Result<Option<<F as TryMapRow<DB>>::Output>, Error> where
    'q: 'e,
    E: RefExecutor<'e, Database = DB>, 
[src]

Get the first row in the result

pub async fn fetch_one<'e, E>(
    self,
    executor: E
) -> Result<<F as TryMapRow<DB>>::Output, Error> where
    'q: 'e,
    E: RefExecutor<'e, Database = DB>, 
[src]

pub async fn fetch_all<'e, E>(
    __arg0: Self,
    executor: E
) -> Result<Vec<<F as TryMapRow<DB>>::Output>, Error> where
    'q: 'e,
    E: RefExecutor<'e, Database = DB>, 
[src]

Auto Trait Implementations

impl<'q, DB, F> RefUnwindSafe for Map<'q, DB, F> where
    DB: RefUnwindSafe,
    F: RefUnwindSafe,
    <DB as Database>::Arguments: RefUnwindSafe

impl<'q, DB, F> Send for Map<'q, DB, F> where
    F: Send,
    <DB as Database>::Arguments: Send

impl<'q, DB, F> Sync for Map<'q, DB, F> where
    DB: Sync,
    F: Sync,
    <DB as Database>::Arguments: Sync

impl<'q, DB, F> Unpin for Map<'q, DB, F> where
    DB: Unpin,
    F: Unpin,
    <DB as Database>::Arguments: Unpin

impl<'q, DB, F> UnwindSafe for Map<'q, DB, F> where
    DB: UnwindSafe,
    F: UnwindSafe,
    <DB as Database>::Arguments: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,