pub struct QueryAs<'q, DB: Database, O, A> { /* private fields */ }
Expand description
Implementations
sourceimpl<'q, DB: Database, O> QueryAs<'q, DB, O, <DB as HasArguments<'q>>::Arguments>
impl<'q, DB: Database, O> QueryAs<'q, DB, O, <DB as HasArguments<'q>>::Arguments>
sourceimpl<'q, DB, O, A> QueryAs<'q, DB, O, A> where
DB: Database + HasStatementCache,
impl<'q, DB, O, A> QueryAs<'q, DB, O, A> where
DB: Database + HasStatementCache,
sourcepub fn persistent(self, value: bool) -> Self
pub fn persistent(self, value: bool) -> Self
If true
, the statement will get prepared once and cached to the
connection’s statement cache.
If queried once with the flag set to true
, all subsequent queries
matching the one with the flag will use the cached statement until the
cache is cleared.
Default: true
.
sourceimpl<'q, DB, O, A> QueryAs<'q, DB, O, A> where
DB: Database,
A: 'q + IntoArguments<'q, DB>,
O: Send + Unpin + for<'r> FromRow<'r, DB::Row>,
impl<'q, DB, O, A> QueryAs<'q, DB, O, A> where
DB: Database,
A: 'q + IntoArguments<'q, DB>,
O: Send + Unpin + for<'r> FromRow<'r, DB::Row>,
sourcepub 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,
O: 'e,
A: 'e,
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,
O: 'e,
A: 'e,
Execute the query and return the generated results as a stream.
sourcepub fn fetch_many<'e, 'c: 'e, E>(
self,
executor: E
) -> BoxStream<'e, Result<Either<DB::QueryResult, O>, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
O: 'e,
A: 'e,
pub fn fetch_many<'e, 'c: 'e, E>(
self,
executor: E
) -> BoxStream<'e, Result<Either<DB::QueryResult, O>, Error>> where
'q: 'e,
E: 'e + Executor<'c, Database = DB>,
DB: 'e,
O: 'e,
A: 'e,
Execute multiple queries and return the generated results as a stream from each query, in a stream.
sourcepub 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,
O: 'e,
A: 'e,
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,
O: 'e,
A: 'e,
Execute the query and return all the generated results, collected into a Vec
.
Trait Implementations
sourceimpl<'q, DB, O: Send, A: Send> Execute<'q, DB> for QueryAs<'q, DB, O, A> where
DB: Database,
A: 'q + IntoArguments<'q, DB>,
impl<'q, DB, O: Send, A: Send> Execute<'q, DB> for QueryAs<'q, DB, O, A> where
DB: Database,
A: 'q + IntoArguments<'q, DB>,
sourcefn statement(&self) -> Option<&<DB as HasStatement<'q>>::Statement>
fn statement(&self) -> Option<&<DB as HasStatement<'q>>::Statement>
Gets the previously cached statement, if available.
sourcefn take_arguments(&mut self) -> Option<<DB as HasArguments<'q>>::Arguments>
fn take_arguments(&mut self) -> Option<<DB as HasArguments<'q>>::Arguments>
Returns the arguments to be bound against the query string. Read more
sourcefn persistent(&self) -> bool
fn persistent(&self) -> bool
Returns true
if the statement should be cached.
Auto Trait Implementations
impl<'q, DB, O, A> RefUnwindSafe for QueryAs<'q, DB, O, A> where
A: RefUnwindSafe,
DB: RefUnwindSafe,
O: RefUnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
impl<'q, DB, O, A> Send for QueryAs<'q, DB, O, A> where
A: Send,
O: Send,
impl<'q, DB, O, A> Sync for QueryAs<'q, DB, O, A> where
A: Sync,
DB: Sync,
O: Sync,
impl<'q, DB, O, A> Unpin for QueryAs<'q, DB, O, A> where
A: Unpin,
DB: Unpin,
O: Unpin,
impl<'q, DB, O, A> UnwindSafe for QueryAs<'q, DB, O, A> where
A: UnwindSafe,
DB: UnwindSafe,
O: UnwindSafe,
<DB as HasStatement<'q>>::Statement: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more