pub struct Query<'s, 'db, S: Schema, Shape: SelectedShape<S>> { /* private fields */ }Expand description
One persistent, reusable singular-shape query lineage.
Each authoring method returns a new lineage and leaves its ancestor usable.
Implementations§
Source§impl<'s, 'db, S: Schema, Shape: SelectedShape<S>> Query<'s, 'db, S, Shape>
impl<'s, 'db, S: Schema, Shape: SelectedShape<S>> Query<'s, 'db, S, Shape>
Sourcepub fn close(&self)
pub fn close(&self)
Explicitly close this immutable query handle.
Closing is idempotent and affects only this handle. Clones, ancestors, descendants, siblings, and the authoring session have independent query lifecycles.
Sourcepub fn match_<M: ThingModel<Schema = S>, Mode: SelectionMode>(
&self,
binding: Binding<S, M, Mode>,
) -> Result<Self>
pub fn match_<M: ThingModel<Schema = S>, Mode: SelectionMode>( &self, binding: Binding<S, M, Mode>, ) -> Result<Self>
Attach one generated binding for predicates without selecting it.
Sourcepub fn where_(&self, predicate: Predicate<S>) -> Result<Self>
pub fn where_(&self, predicate: Predicate<S>) -> Result<Self>
Attach one predicate; repeated calls form a conjunction in call order.
Sourcepub fn where_all(
&self,
predicates: impl IntoIterator<Item = Predicate<S>>,
) -> Result<Self>
pub fn where_all( &self, predicates: impl IntoIterator<Item = Predicate<S>>, ) -> Result<Self>
Attach predicates as one implicit conjunction in source order.
Sourcepub fn allow_cross_join<L: Selectable<S>, R: Selectable<S>>(
&self,
left: L,
right: R,
) -> Result<Self>
pub fn allow_cross_join<L: Selectable<S>, R: Selectable<S>>( &self, left: L, right: R, ) -> Result<Self>
Explicitly permit one topology-level cross join between two attached generated bindings. The returned lineage is immutable and reusable.
Source§impl<'s, 'db, S, Shape> Query<'s, 'db, S, Shape>where
S: Schema,
Shape: SingularSelectedShape<S>,
impl<'s, 'db, S, Shape> Query<'s, 'db, S, Shape>where
S: Schema,
Shape: SingularSelectedShape<S>,
Sourcepub async fn one(&self) -> Result<Shape::Output>
pub async fn one(&self) -> Result<Shape::Output>
Return exactly one distinct selected identity, failing no_result on
an empty stream and not_unique on more than one.
Source§impl<'s, 'db, S: Schema, Shape: SelectedShape<S>> Query<'s, 'db, S, Shape>
impl<'s, 'db, S: Schema, Shape: SelectedShape<S>> Query<'s, 'db, S, Shape>
Sourcepub async fn page_by<R: Selectable<S>>(
&self,
root: R,
options: PageOptions<S>,
) -> Result<Page<Shape::Output>>
pub async fn page_by<R: Selectable<S>>( &self, root: R, options: PageOptions<S>, ) -> Result<Page<Shape::Output>>
Return one resource-bounded page grouped by distinct root identity.
Sourcepub async fn count_by<R: Selectable<S>>(&self, root: R) -> Result<u64>
pub async fn count_by<R: Selectable<S>>(&self, root: R) -> Result<u64>
Count distinct identities of one selected root binding.
Sourcepub async fn exists_by<R: Selectable<S>>(&self, root: R) -> Result<bool>
pub async fn exists_by<R: Selectable<S>>(&self, root: R) -> Result<bool>
Test whether any distinct identity of one selected root binding exists.
Source§impl<'s, 'db, S: Schema, B: Selectable<S>> Query<'s, 'db, S, B>
impl<'s, 'db, S: Schema, B: Selectable<S>> Query<'s, 'db, S, B>
Sourcepub async fn aggregate<T: AggregateTuple<S>>(
&self,
terms: T,
) -> Result<T::Output>
pub async fn aggregate<T: AggregateTuple<S>>( &self, terms: T, ) -> Result<T::Output>
Reduce the distinct selected stream to one typed tuple of aggregate values.
Sourcepub fn group_by<G: Selectable<S>>(
&self,
group: G,
) -> Result<GroupedQuery<'s, 'db, S, B, G>>
pub fn group_by<G: Selectable<S>>( &self, group: G, ) -> Result<GroupedQuery<'s, 'db, S, B, G>>
Group the distinct selected stream by another attached binding’s distinct identities before aggregating.
Sourcepub fn group_by_field<Owner, V>(
&self,
group: BoundField<S, Owner, V>,
) -> Result<FieldGroupedQuery<'s, 'db, S, B, Owner, V>>where
Owner: Model<Schema = S>,
V: GroupedQueryValue,
pub fn group_by_field<Owner, V>(
&self,
group: BoundField<S, Owner, V>,
) -> Result<FieldGroupedQuery<'s, 'db, S, B, Owner, V>>where
Owner: Model<Schema = S>,
V: GroupedQueryValue,
Group the distinct selected stream by each witnessed value of one generated owned field before aggregating.
Sourcepub fn group_by_fields<G>(
&self,
groups: G,
) -> Result<FieldTupleGroupedQuery<'s, 'db, S, B, G>>where
G: FieldGroupTuple<S>,
pub fn group_by_fields<G>(
&self,
groups: G,
) -> Result<FieldTupleGroupedQuery<'s, 'db, S, B, G>>where
G: FieldGroupTuple<S>,
Group the distinct selected stream by the Cartesian tuple of multiple generated owned fields’ witnessed values before aggregating.
Trait Implementations§
Auto Trait Implementations§
impl<'s, 'db, S, Shape> !Freeze for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> !RefUnwindSafe for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> !UnwindSafe for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> Send for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> Sync for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> Unpin for Query<'s, 'db, S, Shape>
impl<'s, 'db, S, Shape> UnsafeUnpin for Query<'s, 'db, S, Shape>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request