pub struct SelectTwoMany<E: EntityTrait, R: EntityTrait> { /* private fields */ }Expand description
A SELECT of an entity together with all of its related rows.
Produced by Select::find_with_related and
Select::find_with_linked. The statement is the joined one of
SelectTwo; all folds the result so that each E
model, identified by its primary key, appears once with the related
models collected in row order. LIMIT and OFFSET are deliberately not
offered because they would count joined rows, not E models.
Implementations§
Source§impl<E: EntityTrait, R: EntityTrait> SelectTwoMany<E, R>
impl<E: EntityTrait, R: EntityTrait> SelectTwoMany<E, R>
Sourcepub fn filter(self, cond: impl IntoCondition) -> Self
pub fn filter(self, cond: impl IntoCondition) -> Self
Adds a WHERE condition, ANDed with the previous ones.
Sourcepub fn order_by(self, column: E::Column, order: Order) -> Self
pub fn order_by(self, column: E::Column, order: Order) -> Self
Adds ORDER BY a column of E in the given direction.
Adds ORDER BY a column of R in the given direction.
Sourcepub fn order_by_expr(self, expr: Expr, order: Order) -> Self
pub fn order_by_expr(self, expr: Expr, order: Order) -> Self
Adds ORDER BY expr in the given direction.
Sourcepub async fn all<C: ConnectionTrait>(
self,
db: &C,
) -> Result<Vec<(E::Model, Vec<R::Model>)>>
pub async fn all<C: ConnectionTrait>( self, db: &C, ) -> Result<Vec<(E::Model, Vec<R::Model>)>>
Fetches every E model with its related R models.
Models are returned in order of first appearance, so an ORDER BY
on E orders the groups and one on R orders within each group.
§Errors
Returns DbErr::Driver when the query fails or a row cannot be decoded.
Trait Implementations§
Source§impl<E: Clone + EntityTrait, R: Clone + EntityTrait> Clone for SelectTwoMany<E, R>
impl<E: Clone + EntityTrait, R: Clone + EntityTrait> Clone for SelectTwoMany<E, R>
Source§impl<E: Debug + EntityTrait, R: Debug + EntityTrait> Debug for SelectTwoMany<E, R>
impl<E: Debug + EntityTrait, R: Debug + EntityTrait> Debug for SelectTwoMany<E, R>
Auto Trait Implementations§
impl<E, R> Freeze for SelectTwoMany<E, R>
impl<E, R> RefUnwindSafe for SelectTwoMany<E, R>where
SelectTwo<E, R>: RefUnwindSafe,
impl<E, R> Send for SelectTwoMany<E, R>
impl<E, R> Sync for SelectTwoMany<E, R>
impl<E, R> Unpin for SelectTwoMany<E, R>
impl<E, R> UnsafeUnpin for SelectTwoMany<E, R>where
SelectTwo<E, R>: UnsafeUnpin,
impl<E, R> UnwindSafe for SelectTwoMany<E, R>where
SelectTwo<E, R>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more