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 Datum
s to
String
s so that the logic can be reused when Datum
s 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.
Modules§
- Nested message and enum types in
ProtoParseError
. - Nested message and enum types in
ProtoParseHexError
.
Macros§
- bail 🔒
Structs§
- 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_range
that formats a single record element. - A helper for
format_record
that formats a single record element.
Enums§
- Yes should be provided for types that will never return true for
ElementEscaper::needs_escaping
Traits§
Functions§
- Escapes a list, record, or map element in place.
- Writes an
acl_item
tobuf
. - Writes a boolean value into
buf
. - Like
format_bool
, but returns a string with a static lifetime. - Writes a
Date
tobuf
. - Writes each
elem
intobuf
, separating the elems withsep
. - Writes an
f32
tobuf
. - Writes an
f64
tobuf
. - Writes an
i16
tobuf
. - Writes an
i32
tobuf
. - Writes an
i64
tobuf
. - Writes an
mz_acl_item
tobuf
. - Writes an
mz_timestamp
tobuf
. - Writes a
Range
tobuf
. - Writes a
NaiveDateTime
timestamp tobuf
. - Writes a
NaiveDateTime
timestamp tobuf
. - Writes a
DateTime<Utc>
timestamp tobuf
. - Writes an
u16
tobuf
. - Writes an
u32
tobuf
. - Writes an
u64
tobuf
. - Parses an AclItem from
s
. - Parses a
bool
froms
. - Parses a
Date
froms
. - Parses an
f32
froms
. - Parses an
f64
froms
. - Parses an
i16
froms
. - Parses an
i32
froms
. - Parses an
i64
froms
. - parse
- 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 MzAclItem from
s
. - Parses an
mz_timestamp
froms
. - Parses an OID from
s
. - Parses a
NaiveTime
froms
, using the following grammar. - Parses a
NaiveDateTime
froms
. - Use the following grammar to parse
s
into: - Parses a
DateTime<Utc>
froms
. Seemz_expr::scalar::func::timezone_timestamp
for timezone anomaly considerations. - Parses an
u16
froms
. - Parses an
u32
froms
. - Parses an
u64
froms
.