[][src]Struct sqlx::query::Query

#[must_use = "query must be executed to affect database"]pub struct Query<'q, DB> where
    DB: Database
{ /* fields omitted */ }

Raw SQL query with bind parameters. Returned by query.

Methods

impl<'q, DB> Query<'q, DB> where
    DB: Database
[src]

pub fn bind<T>(self, value: T) -> Query<'q, DB> where
    T: Type<DB> + Encode<DB>, 
[src]

Bind a value for use with this SQL query.

If the number of times this is called does not match the number of bind parameters that appear in the query (? for most SQL flavors, $1 .. $N for Postgres) then an error will be returned when this query is executed.

There is no validation that the value is of the type expected by the query. Most SQL flavors will perform type coercion (Postgres will return a database error).s

impl<'q, DB> Query<'q, DB> where
    DB: Database
[src]

pub fn map<F, O>(self, mapper: F) -> Map<'q, DB, impl TryMapRow<DB, Output = O>> where
    F: MapRow<DB, Output = O>,
    O: Unpin
[src]

Map each row in the result to another type.

The returned type has most of the same methods but does not have .execute() or `.bind().

See also: [query_as][crate::query_as::query_as].

pub fn try_map<F>(self, mapper: F) -> Map<'q, DB, F> where
    F: TryMapRow<DB>, 
[src]

Map each row in the result to another type.

See also: [query_as][crate::query_as::query_as].

impl<'q, DB> Query<'q, DB> where
    DB: Database,
    Query<'q, DB>: Execute<'q, DB>, 
[src]

pub async fn execute<E>(self, __arg1: E) -> Result<u64, Error> where
    E: Executor<Database = DB>, 
[src]

pub fn fetch<'e, E>(self, executor: E) -> <DB as HasCursor<'e, 'q>>::Cursor where
    E: RefExecutor<'e, Database = DB>, 
[src]

Trait Implementations

impl<'q, DB> Execute<'q, DB> for Query<'q, DB> where
    DB: Database
[src]

Auto Trait Implementations

impl<'q, DB> RefUnwindSafe for Query<'q, DB> where
    DB: RefUnwindSafe,
    <DB as Database>::Arguments: RefUnwindSafe

impl<'q, DB> Send for Query<'q, DB> where
    <DB as Database>::Arguments: Send

impl<'q, DB> Sync for Query<'q, DB> where
    DB: Sync,
    <DB as Database>::Arguments: Sync

impl<'q, DB> Unpin for Query<'q, DB> where
    DB: Unpin,
    <DB as Database>::Arguments: Unpin

impl<'q, DB> UnwindSafe for Query<'q, DB> where
    DB: UnwindSafe,
    <DB as Database>::Arguments: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,