pub struct FindManyOperation<E: QueryEngine, M: Model> { /* private fields */ }Expand description
Implementations§
Source§impl<E: QueryEngine, M: Model + FromRow> FindManyOperation<E, M>
impl<E: QueryEngine, M: Model + FromRow> FindManyOperation<E, M>
Sourcepub fn include(self, spec: IncludeSpec) -> Self
pub fn include(self, spec: IncludeSpec) -> Self
Eager-load a relation alongside the main query.
Each .include() call appends one follow-up SELECT that
fetches the target rows for every parent returned by this
find. Children get stitched onto the parent slice by the
ModelRelationLoader impl emitted by #[derive(Model)].
Sourcepub fn distinct(
self,
columns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn distinct( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Make the query distinct.
Sourcepub fn build_sql(&self, dialect: &dyn SqlDialect) -> (String, Vec<FilterValue>)
pub fn build_sql(&self, dialect: &dyn SqlDialect) -> (String, Vec<FilterValue>)
Build the SQL query.
Sourcepub async fn exec(self) -> QueryResult<Vec<M>>where
M: Send + 'static + ModelRelationLoader<E>,
pub async fn exec(self) -> QueryResult<Vec<M>>where
M: Send + 'static + ModelRelationLoader<E>,
Execute the query.
After the main SELECT hydrates the parent rows, any pending
.include() specs are dispatched through
ModelRelationLoader::load_relation which issues one
additional SELECT per relation and stitches the children onto
the parent slice.
Auto Trait Implementations§
impl<E, M> Freeze for FindManyOperation<E, M>where
E: Freeze,
impl<E, M> RefUnwindSafe for FindManyOperation<E, M>where
E: RefUnwindSafe,
M: RefUnwindSafe,
impl<E, M> Send for FindManyOperation<E, M>
impl<E, M> Sync for FindManyOperation<E, M>
impl<E, M> Unpin for FindManyOperation<E, M>
impl<E, M> UnsafeUnpin for FindManyOperation<E, M>where
E: UnsafeUnpin,
impl<E, M> UnwindSafe for FindManyOperation<E, M>where
E: UnwindSafe,
M: 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
Mutably borrows from an owned value. Read more