Struct SelectTwoMany
pub struct SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,{ /* private fields */ }
Expand description
Defines a structure to perform a SELECT operation on many Models
Implementations§
§impl<E, F> SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
impl<E, F> SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
pub fn into_json(self) -> Selector<SelectTwoModel<Value, Value>>
pub fn into_json(self) -> Selector<SelectTwoModel<Value, Value>>
Convert the results to JSON
pub async fn stream<'a, 'b, C>(
self,
db: &'a C,
) -> Result<impl Stream<Item = Result<(<E as EntityTrait>::Model, Option<<F as EntityTrait>::Model>), DbErr>> + Send + 'b, DbErr>
pub async fn stream<'a, 'b, C>( self, db: &'a C, ) -> Result<impl Stream<Item = Result<(<E as EntityTrait>::Model, Option<<F as EntityTrait>::Model>), DbErr>> + Send + 'b, DbErr>
Stream the result of the operation
pub async fn stream_partial_model<'a, 'b, C, M, N>(
self,
db: &'a C,
) -> Result<impl Stream<Item = Result<(M, Option<N>), DbErr>> + Send + 'b, DbErr>where
'a: 'b,
C: ConnectionTrait + StreamTrait + Send,
M: PartialModelTrait + Send + 'b,
N: PartialModelTrait + Send + 'b,
pub async fn stream_partial_model<'a, 'b, C, M, N>(
self,
db: &'a C,
) -> Result<impl Stream<Item = Result<(M, Option<N>), DbErr>> + Send + 'b, DbErr>where
'a: 'b,
C: ConnectionTrait + StreamTrait + Send,
M: PartialModelTrait + Send + 'b,
N: PartialModelTrait + Send + 'b,
Stream the result of the operation with PartialModel
pub async fn all<C>(
self,
db: &C,
) -> Result<Vec<(<E as EntityTrait>::Model, Vec<<F as EntityTrait>::Model>)>, DbErr>where
C: ConnectionTrait,
pub async fn all<C>(
self,
db: &C,
) -> Result<Vec<(<E as EntityTrait>::Model, Vec<<F as EntityTrait>::Model>)>, DbErr>where
C: ConnectionTrait,
Get all Models from the select operation
SelectTwoMany::one()
method has been dropped (#486)You can get
(Entity, Vec<relatedEntity>)
by first querying a single model from Entity, then useModelTrait::find_related
on the model.See https://www.sea-ql.org/SeaORM/docs/basic-crud/select#lazy-loading for details.
Trait Implementations§
§impl<E, F> Clone for SelectTwoMany<E, F>
impl<E, F> Clone for SelectTwoMany<E, F>
§fn clone(&self) -> SelectTwoMany<E, F>
fn clone(&self) -> SelectTwoMany<E, F>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<E, F> Debug for SelectTwoMany<E, F>
impl<E, F> Debug for SelectTwoMany<E, F>
§impl<E, F> QueryFilter for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
impl<E, F> QueryFilter for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
type QueryStatement = SelectStatement
§fn query(&mut self) -> &mut SelectStatement
fn query(&mut self) -> &mut SelectStatement
Add the query to perform a FILTER on
§fn filter<F>(self, filter: F) -> Selfwhere
F: IntoCondition,
fn filter<F>(self, filter: F) -> Selfwhere
F: IntoCondition,
Add an AND WHERE expression Read more
§fn belongs_to<M>(self, model: &M) -> Selfwhere
M: ModelTrait,
fn belongs_to<M>(self, model: &M) -> Selfwhere
M: ModelTrait,
Apply a where condition using the model’s primary key
§fn belongs_to_tbl_alias<M>(self, model: &M, tbl_alias: &str) -> Selfwhere
M: ModelTrait,
fn belongs_to_tbl_alias<M>(self, model: &M, tbl_alias: &str) -> Selfwhere
M: ModelTrait,
Perform a check to determine table belongs to a Model through it’s name alias
§impl<E, F> QueryOrder for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
impl<E, F> QueryOrder for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
type QueryStatement = SelectStatement
§fn query(&mut self) -> &mut SelectStatement
fn query(&mut self) -> &mut SelectStatement
Add the query to perform an ORDER BY operation
§fn order_by<C>(self, col: C, ord: Order) -> Selfwhere
C: IntoSimpleExpr,
fn order_by<C>(self, col: C, ord: Order) -> Selfwhere
C: IntoSimpleExpr,
Add an order_by expression Read more
§fn order_by_asc<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
fn order_by_asc<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
Add an order_by expression (ascending) Read more
§fn order_by_desc<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
fn order_by_desc<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
Add an order_by expression (descending) Read more
§fn order_by_with_nulls<C>(self, col: C, ord: Order, nulls: NullOrdering) -> Selfwhere
C: IntoSimpleExpr,
fn order_by_with_nulls<C>(self, col: C, ord: Order, nulls: NullOrdering) -> Selfwhere
C: IntoSimpleExpr,
Add an order_by expression with nulls ordering option Read more
§impl<E, F> QuerySelect for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
impl<E, F> QuerySelect for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
type QueryStatement = SelectStatement
§fn query(&mut self) -> &mut SelectStatement
fn query(&mut self) -> &mut SelectStatement
Add the select SQL statement
§fn select_only(self) -> Self
fn select_only(self) -> Self
Clear the selection list
§fn column<C>(self, col: C) -> Selfwhere
C: ColumnTrait,
fn column<C>(self, col: C) -> Selfwhere
C: ColumnTrait,
Add a select column Read more
§fn column_as<C, I>(self, col: C, alias: I) -> Selfwhere
C: IntoSimpleExpr,
I: IntoIdentity,
fn column_as<C, I>(self, col: C, alias: I) -> Selfwhere
C: IntoSimpleExpr,
I: IntoIdentity,
Add a select column with alias Read more
§fn columns<C, I>(self, cols: I) -> Selfwhere
C: ColumnTrait,
I: IntoIterator<Item = C>,
fn columns<C, I>(self, cols: I) -> Selfwhere
C: ColumnTrait,
I: IntoIterator<Item = C>,
Select columns Read more
§fn offset<T>(self, offset: T) -> Self
fn offset<T>(self, offset: T) -> Self
Add an offset expression. Passing in None would remove the offset. Read more
§fn limit<T>(self, limit: T) -> Self
fn limit<T>(self, limit: T) -> Self
Add a limit expression. Passing in None would remove the limit. Read more
§fn group_by<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
fn group_by<C>(self, col: C) -> Selfwhere
C: IntoSimpleExpr,
Add a group by column Read more
§fn having<F>(self, filter: F) -> Selfwhere
F: IntoCondition,
fn having<F>(self, filter: F) -> Selfwhere
F: IntoCondition,
Add an AND HAVING expression Read more
§fn distinct_on<T, I>(self, cols: I) -> Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
fn distinct_on<T, I>(self, cols: I) -> Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
Add a DISTINCT ON expression
NOTE: this function is only supported by
sqlx-postgres
Read more§fn join(self, join: JoinType, rel: RelationDef) -> Self
fn join(self, join: JoinType, rel: RelationDef) -> Self
Join via
RelationDef
.§fn join_rev(self, join: JoinType, rel: RelationDef) -> Self
fn join_rev(self, join: JoinType, rel: RelationDef) -> Self
Join via
RelationDef
but in reverse direction.
Assume when there exist a relation A to B.
You can reverse join B from A.§fn join_as<I>(self, join: JoinType, rel: RelationDef, alias: I) -> Selfwhere
I: IntoIden,
fn join_as<I>(self, join: JoinType, rel: RelationDef, alias: I) -> Selfwhere
I: IntoIden,
Join via
RelationDef
with table alias.§fn join_as_rev<I>(self, join: JoinType, rel: RelationDef, alias: I) -> Selfwhere
I: IntoIden,
fn join_as_rev<I>(self, join: JoinType, rel: RelationDef, alias: I) -> Selfwhere
I: IntoIden,
Join via
RelationDef
with table alias but in reverse direction.
Assume when there exist a relation A to B.
You can reverse join B from A.Select lock shared
§fn lock_exclusive(self) -> Self
fn lock_exclusive(self) -> Self
Select lock exclusive
§fn lock_with_behavior(self, type: LockType, behavior: LockBehavior) -> Self
fn lock_with_behavior(self, type: LockType, behavior: LockBehavior) -> Self
Row locking with behavior (if supported). Read more
§fn expr<T>(self, expr: T) -> Selfwhere
T: Into<SelectExpr>,
fn expr<T>(self, expr: T) -> Selfwhere
T: Into<SelectExpr>,
Add an expression to the select expression list. Read more
§fn exprs<T, I>(self, exprs: I) -> Self
fn exprs<T, I>(self, exprs: I) -> Self
Add select expressions from vector of
SelectExpr
. Read more§fn expr_as_<T, A>(self, expr: T, alias: A) -> Self
fn expr_as_<T, A>(self, expr: T, alias: A) -> Self
Same as
expr_as
. Here for legacy reasons. Read more§fn tbl_col_as<T, C, A>(self, _: (T, C), alias: A) -> Self
fn tbl_col_as<T, C, A>(self, _: (T, C), alias: A) -> Self
Shorthand of
expr_as(Expr::col((T, C)), A)
. Read more§impl<E, F> QueryTrait for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
impl<E, F> QueryTrait for SelectTwoMany<E, F>where
E: EntityTrait,
F: EntityTrait,
§type QueryStatement = SelectStatement
type QueryStatement = SelectStatement
Constrain the QueryStatement to QueryStatementBuilder trait
§fn query(&mut self) -> &mut SelectStatement
fn query(&mut self) -> &mut SelectStatement
Get a mutable ref to the query builder
§fn as_query(&self) -> &SelectStatement
fn as_query(&self) -> &SelectStatement
Get an immutable ref to the query builder
§fn into_query(self) -> SelectStatement
fn into_query(self) -> SelectStatement
Take ownership of the query builder
§fn build(&self, db_backend: DatabaseBackend) -> Statement
fn build(&self, db_backend: DatabaseBackend) -> Statement
Build the query as
Statement
Auto Trait Implementations§
impl<E, F> Freeze for SelectTwoMany<E, F>
impl<E, F> !RefUnwindSafe for SelectTwoMany<E, F>
impl<E, F> Send for SelectTwoMany<E, F>
impl<E, F> Sync for SelectTwoMany<E, F>
impl<E, F> Unpin for SelectTwoMany<E, F>
impl<E, F> !UnwindSafe for SelectTwoMany<E, F>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
Converts
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> ⓘ
Converts
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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.§impl<S> SelectColumns for Swhere
S: QuerySelect,
impl<S> SelectColumns for Swhere
S: QuerySelect,
§fn select_column<C>(self, col: C) -> Swhere
C: ColumnTrait,
fn select_column<C>(self, col: C) -> Swhere
C: ColumnTrait,
Add a select column Read more
§fn select_column_as<C, I>(self, col: C, alias: I) -> Swhere
C: IntoSimpleExpr,
I: IntoIdentity,
fn select_column_as<C, I>(self, col: C, alias: I) -> Swhere
C: IntoSimpleExpr,
I: IntoIdentity,
Add a select column with alias Read more
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.