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 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.
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.
Trait Implementations§
Auto Trait Implementations§
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> Freeze 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
Mutably borrows from an owned value. Read more
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> ⓘ
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 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>
Wrap the input message
T in a tonic::Request