[−][src]Struct sqlx_core::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().
Implementations
impl<'q, DB, F, O, A> Map<'q, DB, F, A> where
DB: Database,
F: Send + Sync + Fn(DB::Row) -> Result<O, Error>,
O: Send + Unpin,
A: 'q + Send + IntoArguments<'q, DB>, [src]
DB: Database,
F: Send + Sync + Fn(DB::Row) -> Result<O, Error>,
O: Send + Unpin,
A: 'q + Send + IntoArguments<'q, DB>,
pub fn fetch<'e, 'c: 'e, E>(
self,
executor: E
) -> BoxStream<'e, Result<O, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e, [src]
self,
executor: E
) -> BoxStream<'e, Result<O, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e,
Execute the query and return the generated results as a stream.
pub fn fetch_many<'e, 'c: 'e, E>(
self,
executor: E
) -> BoxStream<'e, Result<Either<DB::Done, O>, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e, [src]
self,
executor: E
) -> BoxStream<'e, Result<Either<DB::Done, O>, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e,
Execute multiple queries and return the generated results as a stream from each query, in a stream.
pub async fn fetch_all<'e, 'c: 'e, E>(
self,
executor: E
) -> Result<Vec<O>, Error> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e, [src]
self,
executor: E
) -> Result<Vec<O>, Error> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e,
Execute the query and return all the generated results, collected into a Vec.
pub async fn fetch_one<'e, 'c: 'e, E>(self, executor: E) -> Result<O, Error> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e, [src]
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e,
Execute the query and returns exactly one row.
pub async fn fetch_optional<'e, 'c: 'e, E>(
self,
executor: E
) -> Result<Option<O>, Error> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e, [src]
self,
executor: E
) -> Result<Option<O>, Error> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
F: 'e,
O: 'e,
Execute the query and returns at most one row.
Trait Implementations
impl<'q, DB, F: Send, A: Send> Execute<'q, DB> for Map<'q, DB, F, A> where
DB: Database,
A: IntoArguments<'q, DB>, [src]
DB: Database,
A: IntoArguments<'q, DB>,
fn sql(&self) -> &'q str[src]
fn statement(&self) -> Option<&<DB as HasStatement<'q>>::Statement>[src]
fn take_arguments(&mut self) -> Option<<DB as HasArguments<'q>>::Arguments>[src]
fn persistent(&self) -> bool[src]
Auto Trait Implementations
impl<'q, DB, F, A> RefUnwindSafe for Map<'q, DB, F, A> where
A: RefUnwindSafe,
DB: RefUnwindSafe,
F: RefUnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
A: RefUnwindSafe,
DB: RefUnwindSafe,
F: RefUnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
impl<'q, DB, F, A> Send for Map<'q, DB, F, A> where
A: Send,
F: Send,
<DB as HasStatement<'q>>::Statement: Sync,
A: Send,
F: Send,
<DB as HasStatement<'q>>::Statement: Sync,
impl<'q, DB, F, A> Sync for Map<'q, DB, F, A> where
A: Sync,
DB: Sync,
F: Sync,
<DB as HasStatement<'q>>::Statement: Sync,
A: Sync,
DB: Sync,
F: Sync,
<DB as HasStatement<'q>>::Statement: Sync,
impl<'q, DB, F, A> Unpin for Map<'q, DB, F, A> where
A: Unpin,
DB: Unpin,
F: Unpin,
A: Unpin,
DB: Unpin,
F: Unpin,
impl<'q, DB, F, A> UnwindSafe for Map<'q, DB, F, A> where
A: UnwindSafe,
DB: UnwindSafe,
F: UnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
A: UnwindSafe,
DB: UnwindSafe,
F: UnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
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, 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>,