Struct mz_repr::adt::datetime::ParsedDateTime
source · pub struct ParsedDateTime {
pub millennium: Option<DateTimeFieldValue>,
pub century: Option<DateTimeFieldValue>,
pub decade: Option<DateTimeFieldValue>,
pub year: Option<DateTimeFieldValue>,
pub month: Option<DateTimeFieldValue>,
pub day: Option<DateTimeFieldValue>,
pub hour: Option<DateTimeFieldValue>,
pub minute: Option<DateTimeFieldValue>,
pub second: Option<DateTimeFieldValue>,
pub millisecond: Option<DateTimeFieldValue>,
pub microsecond: Option<DateTimeFieldValue>,
pub timezone_offset_second: Option<Timezone>,
}
Expand description
All of the fields that can appear in a literal DATE
, TIME
, TIMESTAMP
or INTERVAL
string.
Fields§
§millennium: Option<DateTimeFieldValue>
§century: Option<DateTimeFieldValue>
§decade: Option<DateTimeFieldValue>
§year: Option<DateTimeFieldValue>
§month: Option<DateTimeFieldValue>
§day: Option<DateTimeFieldValue>
§hour: Option<DateTimeFieldValue>
§minute: Option<DateTimeFieldValue>
§second: Option<DateTimeFieldValue>
§millisecond: Option<DateTimeFieldValue>
§microsecond: Option<DateTimeFieldValue>
§timezone_offset_second: Option<Timezone>
Implementations§
source§impl ParsedDateTime
impl ParsedDateTime
sourcepub fn compute_interval(&self) -> Result<Interval, String>
pub fn compute_interval(&self) -> Result<Interval, String>
Compute an Interval from an ParsedDateTime.
Errors
- If any component overflows a parameter (i.e. i64).
sourcepub fn compute_date(&self) -> Result<NaiveDate, String>
pub fn compute_date(&self) -> Result<NaiveDate, String>
Compute a chrono::NaiveDate from an ParsedDateTime.
Errors
- If year, month, or day overflows their respective parameter in chrono::naive::date::NaiveDate::from_ymd_opt.
Note: Postgres does not recognize Year 0, but in order to make arithmetic work as expected, the Year 1 BC in a ParsedDateTime is mapped to the Year 0 in a NaiveDate, and vice-versa.
sourcepub fn compute_time(&self) -> Result<NaiveTime, String>
pub fn compute_time(&self) -> Result<NaiveTime, String>
Compute a chrono::NaiveDate from an ParsedDateTime.
Errors
- If hour, minute, or second (both
unit
andfraction
) overflowu32
.
sourcepub fn build_parsed_datetime_interval(
value: &str,
leading_time_precision: Option<DateTimeField>,
ambiguous_resolver: DateTimeField
) -> Result<ParsedDateTime, String>
pub fn build_parsed_datetime_interval( value: &str, leading_time_precision: Option<DateTimeField>, ambiguous_resolver: DateTimeField ) -> Result<ParsedDateTime, String>
Builds a ParsedDateTime from an interval string (value
).
Arguments
value
is a PostgreSQL-compatible interval string, e.gINTERVAL 'value'
.leading_time_precision
optionally identifies the leading time component HOUR | MINUTE to disambiguate {}:{} formatted intervalsambiguous_resolver
identifies the DateTimeField of the final part if it’s ambiguous, e.g. inINTERVAL '1' MONTH
‘1’ is ambiguous as its DateTimeField, but MONTH resolves the ambiguity.
sourcepub fn build_parsed_datetime_timestamp(
value: &str
) -> Result<ParsedDateTime, String>
pub fn build_parsed_datetime_timestamp( value: &str ) -> Result<ParsedDateTime, String>
Builds a ParsedDateTime from a TIMESTAMP string (value
).
Arguments
value
is a SQL-formatted TIMESTAMP string.
sourcepub fn build_parsed_datetime_time(value: &str) -> Result<ParsedDateTime, String>
pub fn build_parsed_datetime_time(value: &str) -> Result<ParsedDateTime, String>
sourcepub fn write_field_iff_none(
&mut self,
f: DateTimeField,
u: Option<DateTimeFieldValue>
) -> Result<(), String>
pub fn write_field_iff_none( &mut self, f: DateTimeField, u: Option<DateTimeFieldValue> ) -> Result<(), String>
Write to the specified field of a ParsedDateTime iff it is currently set to None; otherwise generate an error to propagate to the user.
pub fn check_datelike_bounds(&mut self) -> Result<(), String>
pub fn check_interval_bounds(&self, d: DateTimeField) -> Result<(), String>
pub fn clear_date(&mut self)
Trait Implementations§
source§impl Clone for ParsedDateTime
impl Clone for ParsedDateTime
source§fn clone(&self) -> ParsedDateTime
fn clone(&self) -> ParsedDateTime
Returns a copy of the value. Read more
1.0.0 · 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 ParsedDateTime
impl Debug for ParsedDateTime
source§impl Default for ParsedDateTime
impl Default for ParsedDateTime
source§impl Hash for ParsedDateTime
impl Hash for ParsedDateTime
source§impl PartialEq for ParsedDateTime
impl PartialEq for ParsedDateTime
source§fn eq(&self, other: &ParsedDateTime) -> bool
fn eq(&self, other: &ParsedDateTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ParsedDateTime
impl StructuralEq for ParsedDateTime
impl StructuralPartialEq for ParsedDateTime
Auto Trait Implementations§
impl RefUnwindSafe for ParsedDateTime
impl Send for ParsedDateTime
impl Sync for ParsedDateTime
impl Unpin for ParsedDateTime
impl UnwindSafe for ParsedDateTime
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 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.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.