Module mz_repr::adt::datetime

source ·
Expand description

Date and time utilities.


Nested message and enum types in ProtoDateTimeUnits.
Nested message and enum types in ProtoTimezone.


try 🔒
try 🔒
try 🔒
try 🔒


AnnotatedIntervalPart contains the tokens to be parsed, as well as the format to parse them.
An iterator over DateTimeFields
Tracks a unit and a fraction from a parsed time-like string, e.g. INTERVAL ‘1.2’ DAYS.
All of the fields that can appear in a literal DATE, TIME, TIMESTAMP or INTERVAL string.
__Visitor 🔒
__Visitor 🔒


Units of measurements associated with dates and times.
Interval strings can be presented in one of two formats:
TimeStrToken represents valid tokens in time-like strings, i.e those used in INTERVAL, TIMESTAMP/TZ, DATE, and TIME.
Parsed timezone.
__Field 🔒
__Field 🔒



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.
divide i by d rounding to the closest integer
Get the expected TimeStrTokens to parse SQL Standard time-like DateTimeFields, i.e. HOUR, MINUTE, SECOND. This is used for INTERVAL, TIMESTAMP, and TIME.
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.
Fills the year, month, and day fields of pdt using the TimeStrTokens in actual.
Fills a ParsedDateTime’s fields using the actual tokens, starting at leading_field and descending to less significant DateTimeFields.
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.
Fills a ParsedDateTime’s fields when encountering SQL standard-style interval parts, e.g. 1-2 for Y-M 4:5:6.7 for H:M:S.NS.
Fills the hour, minute, and second fields of pdt using the TimeStrTokens in actual.
PostgreSQL treats out-of-place colons as errant punctuation marks, and trims them.
parse_num 🔒
parse_num 🔒
Takes a ‘date timezone’ ‘date time timezone’ string and splits it into ‘date {time}’ and ‘timezone’ components
Convert a string from a time-like datatype (INTERVAL, TIMESTAMP/TZ, DATE, and TIME) into Vec<TimeStrToken>.