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§
- proto_
parse_ error - Nested message and enum types in
ProtoParseError
. - proto_
parse_ hex_ error - Nested message and enum types in
ProtoParseHexError
.
Macros§
- bail 🔒
Structs§
- List
Element 🔒Escaper - List
Element Writer - A helper for
format_list
that formats a single list element. - MapElement
Escaper 🔒 - MapValue
Writer - A helper for
format_map
that formats a single map value. - Parse
Error - An error while parsing an input as a type.
- Proto
Parse Error - Proto
Parse HexError - Range
Element Writer - A helper for
format_range
that formats a single record element. - Record
Element 🔒Escaper - Record
Element Writer - A helper for
format_record
that formats a single record element.
Enums§
- Array
Parsing 🔒Error - Nestable
- Yes should be provided for types that will never return true for
ElementEscaper::needs_escaping
- Parse
Error Kind - Parse
HexError
Traits§
Functions§
- escape_
elem 🔒 - Escapes a list, record, or map element in place.
- format_
acl_ item - Writes an
acl_item
tobuf
. - format_
array - format_
array_ inner - format_
bool - Writes a boolean value into
buf
. - format_
bool_ static - Like
format_bool
, but returns a string with a static lifetime. - format_
bytes - format_
date - Writes a
Date
tobuf
. - format_
elems - Writes each
elem
intobuf
, separating the elems withsep
. - format_
float 🔒 - format_
float32 - Writes an
f32
tobuf
. - format_
float64 - Writes an
f64
tobuf
. - format_
int16 - Writes an
i16
tobuf
. - format_
int32 - Writes an
i32
tobuf
. - format_
int64 - Writes an
i64
tobuf
. - format_
interval - format_
jsonb - format_
jsonb_ pretty - format_
legacy_ vector - format_
list - format_
map - format_
mz_ acl_ item - Writes an
mz_acl_item
tobuf
. - format_
mz_ timestamp - Writes an
mz_timestamp
tobuf
. - format_
nanos_ 🔒to_ micros - format_
numeric - format_
range - Writes a
Range
tobuf
. - format_
record - format_
string - format_
time - Writes a
NaiveDateTime
timestamp tobuf
. - format_
timestamp - Writes a
NaiveDateTime
timestamp tobuf
. - format_
timestamptz - Writes a
DateTime<Utc>
timestamp tobuf
. - format_
uint16 - Writes an
u16
tobuf
. - format_
uint32 - Writes an
u32
tobuf
. - format_
uint64 - Writes an
u64
tobuf
. - format_
uuid - lex_
embedded_ 🔒element - lex_
quoted_ 🔒element - lex_
unquoted_ 🔒element - parse_
acl_ item - Parses an AclItem from
s
. - parse_
array - parse_
array_ 🔒inner - parse_
bool - Parses a
bool
froms
. - parse_
bytes - parse_
bytes_ hex - parse_
bytes_ traditional - parse_
date - Parses a
Date
froms
. - parse_
float 🔒 - parse_
float32 - Parses an
f32
froms
. - parse_
float64 - Parses an
f64
froms
. - parse_
int16 - Parses an
i16
froms
. - parse_
int32 - Parses an
i32
froms
. - parse_
int64 - Parses an
i64
froms
. - parse_
interval - parse
- parse_
interval_ w_ disambiguator - 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_
jsonb - parse_
legacy_ vector - parse_
legacy_ vector_ inner - parse_
list - parse_
list_ 🔒inner - parse_
map - parse_
map_ 🔒inner - parse_
mz_ acl_ item - Parses an MzAclItem from
s
. - parse_
mz_ timestamp - Parses an
mz_timestamp
froms
. - parse_
numeric - parse_
oid - Parses an OID from
s
. - parse_
pg_ legacy_ name - parse_
range - parse_
range_ 🔒inner - parse_
time - Parses a
NaiveTime
froms
, using the following grammar. - parse_
timestamp - Parses a
NaiveDateTime
froms
. - parse_
timestamp_ 🔒string - Use the following grammar to parse
s
into: - parse_
timestamptz - Parses a
DateTime<Utc>
froms
. Seemz_expr::scalar::func::timezone_timestamp
for timezone anomaly considerations. - parse_
uint16 - Parses an
u16
froms
. - parse_
uint32 - Parses an
u32
froms
. - parse_
uint64 - Parses an
u64
froms
. - parse_
uuid