pub struct Query<T> { /* private fields */ }Expand description
A value representing a sql select statement which produces rows of type T.
Implementations§
Source§impl<'scope, T> Query<T>where
T: Table<'scope> + ForLifetimeTable,
impl<'scope, T> Query<T>where
T: Table<'scope> + ForLifetimeTable,
Sourcepub fn aggregate<U>(
self,
f: impl for<'inner, 'outer> FnOnce(&mut A<'inner, 'outer>, T::WithLt<'inner>) -> U::WithLt<'outer>,
) -> Query<U::WithLt<'scope>>where
U: ForLifetimeTable,
pub fn aggregate<U>(
self,
f: impl for<'inner, 'outer> FnOnce(&mut A<'inner, 'outer>, T::WithLt<'inner>) -> U::WithLt<'outer>,
) -> Query<U::WithLt<'scope>>where
U: ForLifetimeTable,
Sourcepub fn many(self) -> Query<ListTable<T>>
pub fn many(self) -> Query<ListTable<T>>
Construct a simple list aggregation for this query.
That is, all rows of this query will be aggregated into an array.
Sourcepub fn window<U>(
self,
f: impl for<'inner, 'outer> FnOnce(&mut W<'inner, 'outer>, T::WithLt<'inner>) -> U::WithLt<'outer>,
) -> Query<U::WithLt<'scope>>where
U: ForLifetimeTable + Table<'scope>,
pub fn window<U>(
self,
f: impl for<'inner, 'outer> FnOnce(&mut W<'inner, 'outer>, T::WithLt<'inner>) -> U::WithLt<'outer>,
) -> Query<U::WithLt<'scope>>where
U: ForLifetimeTable + Table<'scope>,
Enter a context in which W can be used to insert expressions using window functions.
The callback f will receive an [F], the methods of which can be used
to build a table in the 'outer scope.
Sourcepub fn evaluate(table: T) -> Self
pub fn evaluate(table: T) -> Self
Lift a table into a query which ensures side effects happen and are not shared.
Sourcepub fn optional(self) -> Query<MaybeTable<'scope, T>>
pub fn optional(self) -> Query<MaybeTable<'scope, T>>
Sourcepub fn nullable(self) -> Query<NullTable<'scope, T>>
pub fn nullable(self) -> Query<NullTable<'scope, T>>
Make this table nullable. Unlike MaybeTable, this isn’t a left join, but instead considers the table null if any of the non-nullable columns are null.
If the table only contains Option<T> then this table cannot distinguish.
Source§impl<'scope, T> Query<T>
impl<'scope, T> Query<T>
Sourcepub fn each(schema: &TableSchema<T>) -> Query<T::InMode<ExprMode>>
pub fn each(schema: &TableSchema<T>) -> Query<T::InMode<ExprMode>>
Given a TableSchema, build a query that selects all columns of every row.
Source§impl<T: TableLoaderSqlx> Query<T>
impl<T: TableLoaderSqlx> Query<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Query<T>where
T: Freeze,
impl<T> RefUnwindSafe for Query<T>where
T: RefUnwindSafe,
impl<T> Send for Query<T>where
T: Send,
impl<T> Sync for Query<T>where
T: Sync,
impl<T> Unpin for Query<T>where
T: Unpin,
impl<T> UnwindSafe for Query<T>where
T: 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
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 more