pub struct DateFilter { /* private fields */ }Available on crate feature
utils only.Expand description
Date range filter for DateTime<Utc> columns.
Supports setting an upper bound, a lower bound, or both (which collapses to an equality check when the two values are equal). Unset bounds are silently ignored.
Implementations§
Source§impl DateFilter
impl DateFilter
Sourcepub fn new(col: &'static str) -> Self
pub fn new(col: &'static str) -> Self
Create an empty filter for the given column (no bounds — generates no WHERE clause).
Sourcepub fn before(&mut self, date: DateTime<Utc>) -> &mut Self
pub fn before(&mut self, date: DateTime<Utc>) -> &mut Self
Set the upper bound: equivalent to col <= date.
Sourcepub fn after(&mut self, date: DateTime<Utc>) -> &mut Self
pub fn after(&mut self, date: DateTime<Utc>) -> &mut Self
Set the lower bound: equivalent to col >= date.
Sourcepub fn equals(&mut self, date: DateTime<Utc>) -> &mut Self
pub fn equals(&mut self, date: DateTime<Utc>) -> &mut Self
Set both bounds to the same date, collapsing to an equality check col = date.
pub fn build_sql<T>(&self, sql: RawSql<T>) -> RawSql<T>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DateFilter
impl RefUnwindSafe for DateFilter
impl Send for DateFilter
impl Sync for DateFilter
impl Unpin for DateFilter
impl UnsafeUnpin for DateFilter
impl UnwindSafe for DateFilter
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