pub struct Interval {
pub value: Box<Expr>,
pub leading_field: Option<DateTimeField>,
pub leading_precision: Option<u64>,
pub last_field: Option<DateTimeField>,
pub fractional_seconds_precision: Option<u64>,
}
Expand description
Represents an INTERVAL expression, roughly in the following format:
INTERVAL '<value>' [ <leading_field> [ (<leading_precision>) ] ] [ TO <last_field> [ (<fractional_seconds_precision>) ] ]
,
e.g. INTERVAL '123:45.67' MINUTE(3) TO SECOND(2)
.
The parser does not validate the <value>
, nor does it ensure
that the <leading_field>
units >= the units in <last_field>
,
so the user will have to reject intervals like HOUR TO YEAR
.
Fields§
§value: Box<Expr>
§leading_field: Option<DateTimeField>
§leading_precision: Option<u64>
§last_field: Option<DateTimeField>
§fractional_seconds_precision: Option<u64>
The seconds precision can be specified in SQL source as
INTERVAL '__' SECOND(_, x)
(in which case the leading_field
will be Second
and the last_field
will be None
),
or as __ TO SECOND(x)
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Interval
impl<'de> Deserialize<'de> for Interval
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 Ord for Interval
impl Ord for Interval
source§impl PartialEq<Interval> for Interval
impl PartialEq<Interval> for Interval
source§impl PartialOrd<Interval> for Interval
impl PartialOrd<Interval> for Interval
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl VisitMut for Interval
impl VisitMut for Interval
fn visit<V: VisitorMut>(&mut self, visitor: &mut V) -> ControlFlow<V::Break>
impl Eq for Interval
impl StructuralEq for Interval
impl StructuralPartialEq for Interval
Auto Trait Implementations§
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
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