Expand description
Date and time utilities.
Modules§
- proto_
date_ time_ units - Nested message and enum types in
ProtoDateTimeUnits
.
Structs§
- Annotated
Interval 🔒Part - AnnotatedIntervalPart contains the tokens to be parsed, as well as the format to parse them.
- Date
Time Field Iterator - An iterator over DateTimeFields
- Date
Time Field Value - Tracks a unit and a fraction from a parsed time-like string, e.g. INTERVAL ‘1.2’ DAYS.
- Packed
Naive Time - An encoded packed variant of
NaiveTime
. - Parsed
Date Time - All of the fields that can appear in a literal
DATE
,TIME
,TIMESTAMP
orINTERVAL
string. - Proto
Date Time Units
Enums§
- Calendar
Era - Date
Time Field - Date
Time Part - Order of definition is important for PartialOrd and Ord to be derived correctly
- Date
Time Units - Units of measurements associated with dates and times.
- Time
Part 🔒Format - Interval strings can be presented in one of two formats:
- Time
StrToken 🔒 - TimeStrToken represents valid tokens in time-like strings, i.e those used in INTERVAL, TIMESTAMP/TZ, DATE, and TIME.
Functions§
- determine_
format_ 🔒w_ datetimefield - Determines the format of the interval part (uses None to identify an indeterminant/ambiguous format). This is necessary because the interval string format is not LL(1); we instead parse as few tokens as possible to generate the string’s semantics.
- expected_
dur_ 🔒like_ tokens - Get the expected TimeStrTokens to parse SQL Standard time-like DateTimeFields, i.e. HOUR, MINUTE, SECOND. This is used for INTERVAL, TIMESTAMP, and TIME.
- expected_
sql_ 🔒standard_ interval_ tokens - Get the expected TimeStrTokens to parse TimePartFormat::SqlStandard parts,
starting from some
DateTimeField
. Delim tokens are never actually included in the output, but are illustrative of what the expected input of SQL Standard interval values looks like. - fill_
pdt_ 🔒date - Fills the year, month, and day fields of
pdt
using theTimeStrToken
s inactual
. - fill_
pdt_ 🔒from_ tokens - Fills a ParsedDateTime’s fields using the
actual
tokens, starting atleading_field
and descending to less significant DateTimeFields. - fill_
pdt_ 🔒interval_ pg - Fills a ParsedDateTime’s fields for a single PostgreSQL-style interval
parts, e.g.
1 month
. Invoke this function once for each PostgreSQL-style interval part. - fill_
pdt_ 🔒interval_ sql - Fills a ParsedDateTime’s fields when encountering SQL standard-style interval
parts, e.g.
1-2
for Y-M4:5:6.7
for H:M:S.NS. - fill_
pdt_ 🔒time - Fills the hour, minute, and second fields of
pdt
using theTimeStrToken
s inactual
. - ltrim_
delim_ 🔒or_ colon - PostgreSQL treats out-of-place colons as errant punctuation marks, and trims them.
- split_
timestamp_ 🔒string - Takes a ‘date timezone’ ‘date time timezone’ string and splits it into ‘date {time}’ and ‘timezone’ components then checks for a ‘CalenderEra’ defaulting to ‘AD’.
- strip_
era_ 🔒from_ timezone - tokenize_
time_ 🔒str - Convert a string from a time-like datatype (INTERVAL, TIMESTAMP/TZ, DATE, and TIME)
into
Vec<TimeStrToken>
. - trim_
and_ 🔒return_ sign