pub struct Query<'a, T: 'static> { /* private fields */ }Expand description
A query builder for filtering, selecting, ordering, grouping, and aggregating data.
§Type Parameters
'a- The lifetime of the data being queriedT- The type of items in the collection
§Example
ⓘ
let products = vec![/* ... */];
let query = Query::new(&products)
.where_(Product::price(), |&price| price < 100.0)
.order_by_float(Product::price());Implementations§
Source§impl<'a, T: 'static> Query<'a, T>
impl<'a, T: 'static> Query<'a, T>
Sourcepub fn where_<F>(
self,
path: KeyPaths<T, F>,
predicate: impl Fn(&F) -> bool + 'static,
) -> Selfwhere
F: 'static,
pub fn where_<F>(
self,
path: KeyPaths<T, F>,
predicate: impl Fn(&F) -> bool + 'static,
) -> Selfwhere
F: 'static,
Sourcepub fn skip<'b>(&'b self, offset: usize) -> QueryWithSkip<'a, 'b, T>
pub fn skip<'b>(&'b self, offset: usize) -> QueryWithSkip<'a, 'b, T>
Sourcepub fn where_after_systemtime(
self,
path: KeyPaths<T, SystemTime>,
reference: SystemTime,
) -> Self
pub fn where_after_systemtime( self, path: KeyPaths<T, SystemTime>, reference: SystemTime, ) -> Self
Sourcepub fn where_before_systemtime(
self,
path: KeyPaths<T, SystemTime>,
reference: SystemTime,
) -> Self
pub fn where_before_systemtime( self, path: KeyPaths<T, SystemTime>, reference: SystemTime, ) -> Self
Sourcepub fn where_between_systemtime(
self,
path: KeyPaths<T, SystemTime>,
start: SystemTime,
end: SystemTime,
) -> Self
pub fn where_between_systemtime( self, path: KeyPaths<T, SystemTime>, start: SystemTime, end: SystemTime, ) -> Self
Source§impl<'a, T: 'static> Query<'a, T>
impl<'a, T: 'static> Query<'a, T>
Sourcepub fn where_after<Tz>(
self,
path: KeyPaths<T, DateTime<Tz>>,
reference: DateTime<Tz>,
) -> Self
pub fn where_after<Tz>( self, path: KeyPaths<T, DateTime<Tz>>, reference: DateTime<Tz>, ) -> Self
Sourcepub fn where_before<Tz>(
self,
path: KeyPaths<T, DateTime<Tz>>,
reference: DateTime<Tz>,
) -> Self
pub fn where_before<Tz>( self, path: KeyPaths<T, DateTime<Tz>>, reference: DateTime<Tz>, ) -> Self
Sourcepub fn where_between<Tz>(
self,
path: KeyPaths<T, DateTime<Tz>>,
start: DateTime<Tz>,
end: DateTime<Tz>,
) -> Self
pub fn where_between<Tz>( self, path: KeyPaths<T, DateTime<Tz>>, start: DateTime<Tz>, end: DateTime<Tz>, ) -> Self
Sourcepub fn where_today<Tz>(
self,
path: KeyPaths<T, DateTime<Tz>>,
now: DateTime<Tz>,
) -> Self
pub fn where_today<Tz>( self, path: KeyPaths<T, DateTime<Tz>>, now: DateTime<Tz>, ) -> Self
Sourcepub fn where_year<Tz>(self, path: KeyPaths<T, DateTime<Tz>>, year: i32) -> Self
pub fn where_year<Tz>(self, path: KeyPaths<T, DateTime<Tz>>, year: i32) -> Self
Sourcepub fn where_month<Tz>(
self,
path: KeyPaths<T, DateTime<Tz>>,
month: u32,
) -> Self
pub fn where_month<Tz>( self, path: KeyPaths<T, DateTime<Tz>>, month: u32, ) -> Self
Sourcepub fn where_weekend<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
pub fn where_weekend<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
Sourcepub fn where_weekday<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
pub fn where_weekday<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
Sourcepub fn where_business_hours<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
pub fn where_business_hours<Tz>(self, path: KeyPaths<T, DateTime<Tz>>) -> Self
Source§impl<'a, T: 'static + Clone> Query<'a, T>
impl<'a, T: 'static + Clone> Query<'a, T>
Sourcepub fn order_by_desc<F>(&self, path: KeyPaths<T, F>) -> Vec<T>
pub fn order_by_desc<F>(&self, path: KeyPaths<T, F>) -> Vec<T>
Sourcepub fn order_by_float(&self, path: KeyPaths<T, f64>) -> Vec<T>
pub fn order_by_float(&self, path: KeyPaths<T, f64>) -> Vec<T>
Sourcepub fn order_by_float_desc(&self, path: KeyPaths<T, f64>) -> Vec<T>
pub fn order_by_float_desc(&self, path: KeyPaths<T, f64>) -> Vec<T>
Sourcepub fn sum_timestamp(&self, path: KeyPaths<T, i64>) -> i64
pub fn sum_timestamp(&self, path: KeyPaths<T, i64>) -> i64
Sourcepub fn count_timestamp(&self, path: KeyPaths<T, i64>) -> usize
pub fn count_timestamp(&self, path: KeyPaths<T, i64>) -> usize
Sourcepub fn where_after_timestamp(
self,
path: KeyPaths<T, i64>,
reference: i64,
) -> Self
pub fn where_after_timestamp( self, path: KeyPaths<T, i64>, reference: i64, ) -> Self
Sourcepub fn where_before_timestamp(
self,
path: KeyPaths<T, i64>,
reference: i64,
) -> Self
pub fn where_before_timestamp( self, path: KeyPaths<T, i64>, reference: i64, ) -> Self
Sourcepub fn where_last_days_timestamp(
self,
path: KeyPaths<T, i64>,
days: i64,
) -> Self
pub fn where_last_days_timestamp( self, path: KeyPaths<T, i64>, days: i64, ) -> Self
Sourcepub fn where_next_days_timestamp(
self,
path: KeyPaths<T, i64>,
days: i64,
) -> Self
pub fn where_next_days_timestamp( self, path: KeyPaths<T, i64>, days: i64, ) -> Self
Sourcepub fn where_last_hours_timestamp(
self,
path: KeyPaths<T, i64>,
hours: i64,
) -> Self
pub fn where_last_hours_timestamp( self, path: KeyPaths<T, i64>, hours: i64, ) -> Self
Sourcepub fn where_next_hours_timestamp(
self,
path: KeyPaths<T, i64>,
hours: i64,
) -> Self
pub fn where_next_hours_timestamp( self, path: KeyPaths<T, i64>, hours: i64, ) -> Self
Sourcepub fn where_last_minutes_timestamp(
self,
path: KeyPaths<T, i64>,
minutes: i64,
) -> Self
pub fn where_last_minutes_timestamp( self, path: KeyPaths<T, i64>, minutes: i64, ) -> Self
Sourcepub fn where_next_minutes_timestamp(
self,
path: KeyPaths<T, i64>,
minutes: i64,
) -> Self
pub fn where_next_minutes_timestamp( self, path: KeyPaths<T, i64>, minutes: i64, ) -> Self
Sourcepub fn order_by_timestamp(&self, path: KeyPaths<T, i64>) -> Vec<T>
pub fn order_by_timestamp(&self, path: KeyPaths<T, i64>) -> Vec<T>
Auto Trait Implementations§
impl<'a, T> Freeze for Query<'a, T>
impl<'a, T> !RefUnwindSafe for Query<'a, T>
impl<'a, T> !Send for Query<'a, T>
impl<'a, T> !Sync for Query<'a, T>
impl<'a, T> Unpin for Query<'a, T>
impl<'a, T> !UnwindSafe for Query<'a, T>
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