pub enum TemporalGrain {
Day,
Week,
Month,
Quarter,
Year,
}Expand description
Temporal granularity for period boundary calculations.
Unlike TemporalBucket which
includes sub-day granularities (Second, Minute, Hour) for GROUP BY bucketing,
TemporalGrain is restricted to date-level granularities that define meaningful
period boundaries for partial-period UNION ALL queries.
Variants§
Day
Day-level periods.
Week
ISO week (Monday-start) periods.
Month
Calendar month periods.
Quarter
Calendar quarter periods (Q1=Jan, Q2=Apr, Q3=Jul, Q4=Oct).
Year
Calendar year periods.
Implementations§
Source§impl TemporalGrain
impl TemporalGrain
Sourcepub const fn postgres_trunc_arg(self) -> &'static str
pub const fn postgres_trunc_arg(self) -> &'static str
Returns the PostgreSQL DATE_TRUNC argument string.
§Examples
use fraiseql_core::compiler::fact_table::TemporalGrain;
assert_eq!(TemporalGrain::Month.postgres_trunc_arg(), "month");
assert_eq!(TemporalGrain::Quarter.postgres_trunc_arg(), "quarter");Sourcepub const fn to_temporal_bucket(self) -> TemporalBucket
pub const fn to_temporal_bucket(self) -> TemporalBucket
Converts to the corresponding TemporalBucket for use with SQL generators.
Trait Implementations§
Source§impl Clone for TemporalGrain
impl Clone for TemporalGrain
Source§fn clone(&self) -> TemporalGrain
fn clone(&self) -> TemporalGrain
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TemporalGrain
impl Debug for TemporalGrain
Source§impl<'de> Deserialize<'de> for TemporalGrain
impl<'de> Deserialize<'de> for TemporalGrain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TemporalGrain
impl PartialEq for TemporalGrain
Source§fn eq(&self, other: &TemporalGrain) -> bool
fn eq(&self, other: &TemporalGrain) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TemporalGrain
impl Serialize for TemporalGrain
impl Copy for TemporalGrain
impl Eq for TemporalGrain
impl StructuralPartialEq for TemporalGrain
Auto Trait Implementations§
impl Freeze for TemporalGrain
impl RefUnwindSafe for TemporalGrain
impl Send for TemporalGrain
impl Sync for TemporalGrain
impl Unpin for TemporalGrain
impl UnsafeUnpin for TemporalGrain
impl UnwindSafe for TemporalGrain
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.