Expand description

Routines for converting datum values to and from their string representation.

The functions in this module are tightly related to the variants of ScalarType. Each variant has a pair of functions in this module named parse_VARIANT and format_VARIANT. The type returned by parse functions, and the type accepted by format functions, will be a type that is easily converted into the Datum variant for that type. The functions do not directly convert from Datums to Strings so that the logic can be reused when Datums are not available or desired, as in the pgrepr crate.

The string representations used are exactly the same as the PostgreSQL string representations for the corresponding PostgreSQL type. Deviations should be considered a bug.


Nested message and enum types in ProtoParseError.
Nested message and enum types in ProtoParseHexError.


A helper for format_list that formats a single list element.
A helper for format_map that formats a single map value.
An error while parsing an input as a type.
A helper for format_record that formats a single record element.


Yes should be provided for types that will never return true for ElementEscaper::needs_escaping



Writes a boolean value into buf.
Like format_bool, but returns a string with a static lifetime.
Writes a Date to buf.
Writes each elem into buf, separating the elems with sep.
Writes an f32 to buf.
Writes an f64 to buf.
Writes an i16 to buf.
Writes an i32 to buf.
Writes an i64 to buf.
Writes an mztimestamp to buf.
Writes a NaiveDateTime timestamp to buf.
Writes a NaiveDateTime timestamp to buf.
Writes a DateTime<Utc> timestamp to buf.
Writes an u16 to buf.
Writes an u32 to buf.
Writes an u64 to buf.
Parses a bool from s.
Parses a Date from s.
Parses an f32 from s.
Parses an f64 from s.
Parses an i16 from s.
Parses an i32 from s.
Parses an i64 from s.
Parse an interval string, using an optional leading precision for time (H:M:S) and a specific mz_sql_parser::ast::DateTimeField to identify ambiguous elements. For more information about this operation, see the documentation on ParsedDateTime::build_parsed_datetime_interval.
Parses an mztimestamp from s.
Parses an OID from s.
Parses a NaiveTime from s, using the following grammar.
Parses a NaiveDateTime from s.
Parses a DateTime<Utc> from s. See mz_expr::scalar::func::timezone_timestamp for timezone anomaly considerations.
Parses an u16 from s.
Parses an u32 from s.
Parses an u64 from s.