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§
§impl<'de> Deserialize<'de> for Interval
impl<'de> Deserialize<'de> for Interval
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Interval, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Interval, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Ord for Interval
impl Ord for Interval
§impl PartialOrd for Interval
impl PartialOrd for Interval
§fn partial_cmp(&self, other: &Interval) -> Option<Ordering>
fn partial_cmp(&self, other: &Interval) -> Option<Ordering>
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 more§impl Serialize for Interval
impl Serialize for Interval
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.