[−][src]Struct sqlx::query::Map
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]
DB: Database,
F: TryMapRow<DB>,
Query<'q, DB>: Execute<'q, DB>,
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]
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,
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]
self,
executor: E
) -> Result<Option<<F as TryMapRow<DB>>::Output>, Error> where
'q: 'e,
E: RefExecutor<'e, Database = DB>,
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]
self,
executor: E
) -> Result<<F as TryMapRow<DB>>::Output, Error> where
'q: 'e,
E: RefExecutor<'e, Database = DB>,
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]
__arg0: Self,
executor: E
) -> Result<Vec<<F as TryMapRow<DB>>::Output>, Error> where
'q: 'e,
E: RefExecutor<'e, Database = DB>,
Auto Trait Implementations
impl<'q, DB, F> RefUnwindSafe for Map<'q, DB, F> where
DB: RefUnwindSafe,
F: RefUnwindSafe,
<DB as Database>::Arguments: RefUnwindSafe,
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,
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,
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,
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,
DB: UnwindSafe,
F: UnwindSafe,
<DB as Database>::Arguments: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,