Skip to main content

BoundQuery

Struct BoundQuery 

Source
pub struct BoundQuery<'db, Q> { /* private fields */ }
Expand description

A query bound to the database that created it.

Created by Database::query. Execution methods use that same database, including its configured runtime. Standalone DatabaseQuery values remain independent and accept an explicit database when executed.

Implementations§

Source§

impl<'db, M: Model> BoundQuery<'db, DatabaseQuery<M>>

Source

pub fn filter(self, expr: Expr) -> Self

Source

pub fn order_by(self, order: OrderBy) -> Self

Source

pub fn limit(self, limit: u64) -> Self

Source

pub fn offset(self, offset: u64) -> Self

Source

pub async fn all(self) -> Result<Vec<M>, OrmError>
where M: Send + 'static,

Source

pub async fn first(self) -> Result<Option<M>, OrmError>
where M: Send + 'static,

Source

pub async fn count(self) -> Result<usize, OrmError>
where M: Send + 'static,

Source

pub fn into_select_query(self) -> SelectQuery<M>

Source§

impl<M: Model, R, Relation, Key> BoundQuery<'_, SelectRelatedQuery<M, R, Relation, Key>>

Source

pub fn filter(self, expr: Expr) -> Self

Source

pub fn order_by(self, order: OrderBy) -> Self

Source

pub fn limit(self, limit: u64) -> Self

Source

pub fn offset(self, offset: u64) -> Self

Source

pub async fn count(self) -> Result<usize, OrmError>
where M: Send + 'static, R: Model, Key: ForeignKeyValue<R::PrimaryKey>,

Source§

impl<'db, M, R, Relation, Key: PrimaryKey> BoundQuery<'db, SelectRelatedQuery<M, R, Relation, Key>>
where M: Model + Send + 'static, R: Model + Send + 'static,

Source

pub async fn all(self) -> Result<Vec<WithOne<M, R, Relation, Key>>, OrmError>

Source§

impl<M, R, Relation, Key: PrimaryKey> BoundQuery<'_, SelectRelatedQuery<M, R, Relation, Option<Key>>>
where M: Model + Send + 'static, R: Model + Send + 'static,

Source

pub async fn all(self) -> Result<Vec<WithOptionalOne<M, R, Relation>>, OrmError>

Source§

impl<M, R1, Relation1, R2, Relation2, Key1> BoundQuery<'_, MultiSelectRelatedQuery<M, R1, Relation1, R2, Relation2, Key1>>
where M: Model + Send + 'static, R1: Model + Send + 'static, R2: Model + Send + 'static,

Source

pub fn filter(self, expr: Expr) -> Self

Source

pub fn order_by(self, order: OrderBy) -> Self

Source

pub async fn all( self, ) -> Result<Vec<Loaded<M, (LoadedOne<R1, Relation1>, LoadedOne<R2, Relation2>)>>, OrmError>

Source§

impl<'db, M, R, Relation, Key> BoundQuery<'db, PrefetchRelatedQuery<M, R, Relation, Key>>
where M: Model + Send + 'static, R: Model + Send + 'static, Key: ForeignKeyValue<M::PrimaryKey>,

Source

pub fn filter(self, expr: Expr) -> Self

Source

pub fn order_by(self, order: OrderBy) -> Self

Source

pub fn limit(self, limit: u64) -> Self

Source

pub fn offset(self, offset: u64) -> Self

Source

pub async fn count(self) -> Result<usize, OrmError>

Source

pub async fn all( self, ) -> Result<Vec<Loaded<M, (LoadedMany<R, Relation>,)>>, OrmError>
where Relation: Send + 'static,

Source§

impl<M, R1, Relation1, R2, Relation2, Key1, Key2> BoundQuery<'_, MultiPrefetchRelatedQuery<M, R1, Relation1, R2, Relation2, Key1, Key2>>
where M: Model + Send + 'static, R1: Model + Send + 'static, R2: Model + Send + 'static, Relation1: Send + 'static, Relation2: Send + 'static, Key1: ForeignKeyValue<M::PrimaryKey>, Key2: ForeignKeyValue<M::PrimaryKey>,

Source

pub async fn all( self, ) -> Result<Vec<Loaded<M, (LoadedMany<R1, Relation1>, LoadedMany<R2, Relation2>)>>, OrmError>

Source§

impl<M, R, Relation, C, ChildRelation, OuterKey, InnerKey> BoundQuery<'_, NestedPrefetchQuery<M, R, Relation, C, ChildRelation, OuterKey, InnerKey>>
where M: Model + Send + 'static, R: Model + Send + 'static, C: Model + Send + 'static, Relation: Send + 'static, ChildRelation: Send + 'static, OuterKey: ForeignKeyValue<M::PrimaryKey>, InnerKey: ForeignKeyValue<R::PrimaryKey>,

Source

pub async fn all( self, ) -> Result<Vec<Loaded<M, (LoadedMany<Loaded<R, (LoadedMany<C, ChildRelation>,)>, Relation>,)>>, OrmError>

Auto Trait Implementations§

§

impl<'db, Q> !RefUnwindSafe for BoundQuery<'db, Q>

§

impl<'db, Q> !UnwindSafe for BoundQuery<'db, Q>

§

impl<'db, Q> Forget for BoundQuery<'db, Q>

§

impl<'db, Q> Freeze for BoundQuery<'db, Q>
where Q: Freeze,

§

impl<'db, Q> Move for BoundQuery<'db, Q>

§

impl<'db, Q> Send for BoundQuery<'db, Q>
where Q: Send,

§

impl<'db, Q> Sync for BoundQuery<'db, Q>
where Q: Sync,

§

impl<'db, Q> Unpin for BoundQuery<'db, Q>
where Q: Unpin,

§

impl<'db, Q> UnsafeUnpin for BoundQuery<'db, Q>
where Q: UnsafeUnpin,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.