Struct repr::adt::datetime::ParsedDateTime[][src]

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

Compute an Interval from an ParsedDateTime.

Errors
  • If any component overflows a parameter (i.e. i64).

Adds the appropriate values from self’s ParsedDateTime to months, seconds, and nanos. These fields are then appropriate to construct std::time::Duration, once accounting for their sign.

Errors
  • If any component overflows a parameter (i.e. i64).

Compute a chrono::NaiveDate from an ParsedDateTime.

Errors

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.

Compute a chrono::NaiveDate from an ParsedDateTime.

Errors
  • If hour, minute, or second (both unit and fraction) overflow u32.

Builds a ParsedDateTime from an interval string (value).

Arguments
  • value is a PostgreSQL-compatible interval string, e.g INTERVAL 'value'.
  • leading_time_precision optionally identifies the leading time component HOUR | MINUTE to disambiguate {}:{} formatted intervals
  • ambiguous_resolver identifies the DateTimeField of the final part if it’s ambiguous, e.g. in INTERVAL '1' MONTH ‘1’ is ambiguous as its DateTimeField, but MONTH resolves the ambiguity.

Builds a ParsedDateTime from a TIMESTAMP string (value).

Arguments
  • value is a SQL-formatted TIMESTAMP string.

Builds a ParsedDateTime from a TIME string (value).

Arguments
  • value is a SQL-formatted TIME 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.

Retrieve any value that we parsed out of the literal string for the field.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more