mod common;
mod date;
mod error;
mod interval;
mod parse;
mod time;
mod timestamp;
mod timezone;
mod token;
#[cfg(feature = "serde")]
mod serialize;
pub use crate::date::Date;
pub use crate::error::DateTimeError;
pub use crate::interval::Interval;
pub use crate::time::Time;
pub use crate::timestamp::Timestamp;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum DateUnit {
Delta,
Second,
Minute,
Hour,
Day,
Week,
Month,
Quarter,
Year,
Decade,
Century,
MilliSec,
MicroSec,
JULIAN,
Dow,
IsoDow,
Doy,
Tz,
TzMinute,
TzHour,
Millennium,
IsoYear,
Epoch,
}
pub trait DateTime: Sized {
fn date_part(&self, ty: FieldType, unit: DateUnit) -> Result<Option<f64>, DateTimeError>;
fn is_finite(&self) -> bool;
#[inline]
fn is_infinite(&self) -> bool {
!self.is_finite()
}
fn truncate(&self, ty: FieldType, unit: DateUnit) -> Result<Self, DateTimeError>;
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum DateOrder {
YMD,
DMY,
MDY,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum DateStyle {
Postgres,
ISO,
SQL,
German,
XSD,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum IntervalStyle {
Postgres,
PostgresVerbose,
SQLStandard,
ISO8601,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum FieldType {
Unit,
Epoch,
}