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ยง
- List
Element ๐Escaper - A helper for
format_list
that formats a single list element. - MapElement
Escaper ๐ - 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. - Record
Element ๐Escaper - A helper for
format_record
that formats a single record element.
Enumsยง
- Array
Parsing ๐Error - Yes should be provided for types that will never return true for
ElementEscaper::needs_escaping
Traitsยง
Functionsยง
- escape_
elem ๐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
. - format_
float ๐ - 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
. - lex_
embedded_ ๐element - lex_
quoted_ ๐element - lex_
unquoted_ ๐element - Parses an AclItem from
s
. - parse_
array_ ๐inner - Parses a
bool
froms
. - Parses a
Date
froms
. - parse_
float ๐ - 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.
- parse_
list_ ๐inner - parse_
map_ ๐inner - Parses an MzAclItem from
s
. - Parses an
mz_timestamp
froms
. - Parses an OID from
s
. - parse_
range_ ๐inner - 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
.