pub struct QueryAs<'a, T> { /* private fields */ }Expand description
A prepared query decoded into T.
Implementations§
Source§impl<'a, T: FromRow> QueryAs<'a, T>
impl<'a, T: FromRow> QueryAs<'a, T>
Sourcepub fn new(sql: &'a str, params: &'a [&'a dyn ToSql]) -> Self
pub fn new(sql: &'a str, params: &'a [&'a dyn ToSql]) -> Self
Builds a typed query from SQL and already-built parameters.
Sourcepub async fn execute<E: Executor>(&self, executor: &E) -> Result<u64, Error>
pub async fn execute<E: Executor>(&self, executor: &E) -> Result<u64, Error>
Runs the statement and returns the number of affected rows.
See Query::execute: rows produced by the statement are discarded.
Sourcepub async fn fetch_rows<E: Executor>(
&self,
executor: &E,
) -> Result<RowStream, Error>
pub async fn fetch_rows<E: Executor>( &self, executor: &E, ) -> Result<RowStream, Error>
Runs the statement and returns a stream of rows.
Sourcepub async fn fetch_all<E: Executor>(
&self,
executor: &E,
) -> Result<Vec<T>, Error>
pub async fn fetch_all<E: Executor>( &self, executor: &E, ) -> Result<Vec<T>, Error>
Collects all rows into a Vec<T>.
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for QueryAs<'a, T>
impl<'a, T> !UnwindSafe for QueryAs<'a, T>
impl<'a, T> Freeze for QueryAs<'a, T>
impl<'a, T> Send for QueryAs<'a, T>
impl<'a, T> Sync for QueryAs<'a, T>
impl<'a, T> Unpin for QueryAs<'a, T>
impl<'a, T> UnsafeUnpin for QueryAs<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more