Skip to main content

Query

Struct Query 

Source
pub struct Query<'val, SQL, Exe, R> { /* private fields */ }
Expand description

The query API.

Implementations§

Source§

impl<'val, SQL, Exe, R> Query<'val, SQL, Exe, R>

Source

pub fn bind<V: Encode<'val>>(self, value: V) -> Self

Bind query parameter.

Source§

impl<'val, SQL, Exe, R> Query<'val, SQL, Exe, R>
where Exe: Executor,

Source

pub fn fetch(self) -> FetchStream<'val, SQL, Exe::Future, Exe::Transport, R>

Fetch rows using Stream api.

The returned Stream must be polled/awaited until completion, otherwise it will disturb subsequent query.

Source

pub fn fetch_all(self) -> FetchAll<'val, SQL, Exe::Future, Exe::Transport, R>

Fetch all rows into Vec.

Source

pub fn fetch_one(self) -> FetchOne<'val, SQL, Exe::Future, Exe::Transport, R>

Fetch one row.

Source

pub fn fetch_optional( self, ) -> FetchOptional<'val, SQL, Exe::Future, Exe::Transport, R>

Optionally fetch one row.

Source

pub fn execute(self) -> Execute<'val, SQL, Exe::Future, Exe::Transport>

Execute statement and return number of rows affected.

Trait Implementations§

Source§

impl<'val, SQL: Debug, Exe: Debug, R: Debug> Debug for Query<'val, SQL, Exe, R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'val, SQL, Exe, R> IntoFuture for Query<'val, SQL, Exe, R>
where SQL: Sql + Unpin, Exe: Executor + Unpin,

Source§

type Output = Result<RowResult, Error>

The output that the future will produce on completion.
Source§

type IntoFuture = Execute<'val, SQL, <Exe as Executor>::Future, <Exe as Executor>::Transport>

Which kind of future are we turning this into?
Source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more

Auto Trait Implementations§

§

impl<'val, SQL, Exe, R> Freeze for Query<'val, SQL, Exe, R>
where SQL: Freeze, Exe: Freeze,

§

impl<'val, SQL, Exe, R> RefUnwindSafe for Query<'val, SQL, Exe, R>

§

impl<'val, SQL, Exe, R> Send for Query<'val, SQL, Exe, R>
where SQL: Send, Exe: Send, R: Send,

§

impl<'val, SQL, Exe, R> Sync for Query<'val, SQL, Exe, R>
where SQL: Sync, Exe: Sync, R: Sync,

§

impl<'val, SQL, Exe, R> Unpin for Query<'val, SQL, Exe, R>
where SQL: Unpin, Exe: Unpin, R: Unpin,

§

impl<'val, SQL, Exe, R> UnsafeUnpin for Query<'val, SQL, Exe, R>
where SQL: UnsafeUnpin, Exe: UnsafeUnpin,

§

impl<'val, SQL, Exe, R> UnwindSafe for Query<'val, SQL, Exe, R>
where SQL: UnwindSafe, Exe: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.