pub type Map = Map<String, JsonValue>;
Expand description
A JSON key-value type.
Aliased Type§
struct Map { /* private fields */ }
Trait Implementations§
source§impl DecodeRow<SqliteRow> for Map
Available on crate features orm
and orm-sqlx
only.
impl DecodeRow<SqliteRow> for Map
Available on crate features
orm
and orm-sqlx
only.source§fn decode_row(row: &DatabaseRow) -> Result<Self, Self::Error>
fn decode_row(row: &DatabaseRow) -> Result<Self, Self::Error>
Decodes a row and attempts to create an instance of
Self
.source§impl JsonObjectExt for Map
impl JsonObjectExt for Map
source§fn get_bool(&self, key: &str) -> Option<bool>
fn get_bool(&self, key: &str) -> Option<bool>
Extracts the boolean value corresponding to the key.
source§fn get_u8(&self, key: &str) -> Option<u8>
fn get_u8(&self, key: &str) -> Option<u8>
Extracts the integer value corresponding to the key
and represents it as
u8
if possible.source§fn get_u16(&self, key: &str) -> Option<u16>
fn get_u16(&self, key: &str) -> Option<u16>
Extracts the integer value corresponding to the key
and represents it as
u16
if possible.source§fn get_u32(&self, key: &str) -> Option<u32>
fn get_u32(&self, key: &str) -> Option<u32>
Extracts the integer value corresponding to the key
and represents it as
u32
if possible.source§fn get_u64(&self, key: &str) -> Option<u64>
fn get_u64(&self, key: &str) -> Option<u64>
Extracts the integer value corresponding to the key
and represents it as
u64
if possible.source§fn get_usize(&self, key: &str) -> Option<usize>
fn get_usize(&self, key: &str) -> Option<usize>
Extracts the integer value corresponding to the key
and represents it as
usize
if possible.source§fn get_i8(&self, key: &str) -> Option<i8>
fn get_i8(&self, key: &str) -> Option<i8>
Extracts the integer value corresponding to the key
and represents it as
i8
if possible.source§fn get_i16(&self, key: &str) -> Option<i16>
fn get_i16(&self, key: &str) -> Option<i16>
Extracts the integer value corresponding to the key
and represents it as
i16
if possible.source§fn get_i32(&self, key: &str) -> Option<i32>
fn get_i32(&self, key: &str) -> Option<i32>
Extracts the integer value corresponding to the key
and represents it as
i32
if possible.source§fn get_i64(&self, key: &str) -> Option<i64>
fn get_i64(&self, key: &str) -> Option<i64>
Extracts the integer value corresponding to the key.
source§fn get_isize(&self, key: &str) -> Option<isize>
fn get_isize(&self, key: &str) -> Option<isize>
Extracts the integer value corresponding to the key
and represents it as
isize
if possible.source§fn get_f32(&self, key: &str) -> Option<f32>
fn get_f32(&self, key: &str) -> Option<f32>
Extracts the float value corresponding to the key
and represents it as
f32
if possible.source§fn get_f64(&self, key: &str) -> Option<f64>
fn get_f64(&self, key: &str) -> Option<f64>
Extracts the float value corresponding to the key.
source§fn get_uuid(&self, key: &str) -> Option<Uuid>
fn get_uuid(&self, key: &str) -> Option<Uuid>
Extracts the string corresponding to the key
and represents it as
Uuid
if possible.source§fn get_date(&self, key: &str) -> Option<Date>
fn get_date(&self, key: &str) -> Option<Date>
Extracts the string corresponding to the key
and represents it as
Date
if possible.source§fn get_time(&self, key: &str) -> Option<Time>
fn get_time(&self, key: &str) -> Option<Time>
Extracts the string corresponding to the key
and represents it as
Time
if possible.source§fn get_datetime(&self, key: &str) -> Option<DateTime>
fn get_datetime(&self, key: &str) -> Option<DateTime>
Extracts the string corresponding to the key
and represents it as
DateTime
if possible.source§fn get_duration(&self, key: &str) -> Option<Duration>
fn get_duration(&self, key: &str) -> Option<Duration>
Extracts the string corresponding to the key
and represents it as
Duration
if possible.source§fn get_array(&self, key: &str) -> Option<&Vec<JsonValue>>
fn get_array(&self, key: &str) -> Option<&Vec<JsonValue>>
Extracts the array value corresponding to the key.
source§fn get_u64_array(&self, key: &str) -> Option<Vec<u64>>
fn get_u64_array(&self, key: &str) -> Option<Vec<u64>>
Extracts the array value corresponding to the key and parses it as
Vec<u64>
.source§fn get_i64_array(&self, key: &str) -> Option<Vec<i64>>
fn get_i64_array(&self, key: &str) -> Option<Vec<i64>>
Extracts the array value corresponding to the key and parses it as
Vec<i64>
.source§fn get_f32_array(&self, key: &str) -> Option<Vec<f32>>
fn get_f32_array(&self, key: &str) -> Option<Vec<f32>>
Extracts the array value corresponding to the key and parses it as
Vec<f32>
.source§fn get_f64_array(&self, key: &str) -> Option<Vec<f64>>
fn get_f64_array(&self, key: &str) -> Option<Vec<f64>>
Extracts the array value corresponding to the key and parses it as
Vec<f64>
.source§fn get_str_array(&self, key: &str) -> Option<Vec<&str>>
fn get_str_array(&self, key: &str) -> Option<Vec<&str>>
Extracts the array value corresponding to the key and parses it as
Vec<&str>
.source§fn get_map_array(&self, key: &str) -> Option<Vec<&Map>>
fn get_map_array(&self, key: &str) -> Option<Vec<&Map>>
Extracts the array value corresponding to the key and parses it as
Vec<&Map>
.source§fn get_object(&self, key: &str) -> Option<&Map>
fn get_object(&self, key: &str) -> Option<&Map>
Extracts the object value corresponding to the key.
source§fn get_populated(&self, key: &str) -> Option<&Map>
fn get_populated(&self, key: &str) -> Option<&Map>
Extracts the populated data corresponding to the key.
source§fn get_translated(&self, key: &str) -> Option<&str>
fn get_translated(&self, key: &str) -> Option<&str>
Extracts the translated string value corresponding to the key.
source§fn parse_bool(&self, key: &str) -> Option<Result<bool, ParseBoolError>>
fn parse_bool(&self, key: &str) -> Option<Result<bool, ParseBoolError>>
Extracts the value corresponding to the key and parses it as
bool
.source§fn parse_u8(&self, key: &str) -> Option<Result<u8, ParseIntError>>
fn parse_u8(&self, key: &str) -> Option<Result<u8, ParseIntError>>
Extracts the value corresponding to the key and parses it as
u8
.source§fn parse_u16(&self, key: &str) -> Option<Result<u16, ParseIntError>>
fn parse_u16(&self, key: &str) -> Option<Result<u16, ParseIntError>>
Extracts the value corresponding to the key and parses it as
u16
.source§fn parse_u32(&self, key: &str) -> Option<Result<u32, ParseIntError>>
fn parse_u32(&self, key: &str) -> Option<Result<u32, ParseIntError>>
Extracts the value corresponding to the key and parses it as
u32
.source§fn parse_u64(&self, key: &str) -> Option<Result<u64, ParseIntError>>
fn parse_u64(&self, key: &str) -> Option<Result<u64, ParseIntError>>
Extracts the value corresponding to the key and parses it as
u64
.source§fn parse_usize(&self, key: &str) -> Option<Result<usize, ParseIntError>>
fn parse_usize(&self, key: &str) -> Option<Result<usize, ParseIntError>>
Extracts the value corresponding to the key and parses it as
usize
.source§fn parse_i8(&self, key: &str) -> Option<Result<i8, ParseIntError>>
fn parse_i8(&self, key: &str) -> Option<Result<i8, ParseIntError>>
Extracts the value corresponding to the key and parses it as
i8
.source§fn parse_i16(&self, key: &str) -> Option<Result<i16, ParseIntError>>
fn parse_i16(&self, key: &str) -> Option<Result<i16, ParseIntError>>
Extracts the value corresponding to the key and parses it as
i16
.source§fn parse_i32(&self, key: &str) -> Option<Result<i32, ParseIntError>>
fn parse_i32(&self, key: &str) -> Option<Result<i32, ParseIntError>>
Extracts the value corresponding to the key and parses it as
i32
.source§fn parse_i64(&self, key: &str) -> Option<Result<i64, ParseIntError>>
fn parse_i64(&self, key: &str) -> Option<Result<i64, ParseIntError>>
Extracts the value corresponding to the key and parses it as
i64
.source§fn parse_isize(&self, key: &str) -> Option<Result<isize, ParseIntError>>
fn parse_isize(&self, key: &str) -> Option<Result<isize, ParseIntError>>
Extracts the value corresponding to the key and parses it as
isize
.source§fn parse_f32(&self, key: &str) -> Option<Result<f32, ParseFloatError>>
fn parse_f32(&self, key: &str) -> Option<Result<f32, ParseFloatError>>
Extracts the value corresponding to the key and parses it as
f32
.source§fn parse_f64(&self, key: &str) -> Option<Result<f64, ParseFloatError>>
fn parse_f64(&self, key: &str) -> Option<Result<f64, ParseFloatError>>
Extracts the value corresponding to the key and parses it as
f64
.source§fn parse_string(&self, key: &str) -> Option<Cow<'_, str>>
fn parse_string(&self, key: &str) -> Option<Cow<'_, str>>
Extracts the value corresponding to the key and parses it as
Cow<'_, str>
.
If the str is empty, it also returns None
.source§fn parse_array<T: FromStr>(
&self,
key: &str
) -> Option<Result<Vec<T>, <T as FromStr>::Err>>
fn parse_array<T: FromStr>( &self, key: &str ) -> Option<Result<Vec<T>, <T as FromStr>::Err>>
Extracts the array value corresponding to the key and parses it as
Vec<T>
.
If the vec is empty, it also returns None
.source§fn parse_str_array(&self, key: &str) -> Option<Vec<&str>>
fn parse_str_array(&self, key: &str) -> Option<Vec<&str>>
Extracts the array value corresponding to the key and parses it as
Vec<&str>
.
If the vec is empty, it also returns None
.source§fn parse_enum_values(&self, key: &str) -> Option<Vec<JsonValue>>
fn parse_enum_values(&self, key: &str) -> Option<Vec<JsonValue>>
Extracts the enum values corresponding to the key
and parses it as
Vec<i64>
or Vec<String>
.
If the vec is empty, it also returns None
.source§fn parse_object(&self, key: &str) -> Option<&Map>
fn parse_object(&self, key: &str) -> Option<&Map>
Extracts the object value corresponding to the key and parses it as
Map
.
If the map is empty, it also returns None
.source§fn parse_uuid(&self, key: &str) -> Option<Result<Uuid, Error>>
fn parse_uuid(&self, key: &str) -> Option<Result<Uuid, Error>>
Extracts the string corresponding to the key and parses it as
Uuid
.
If the Uuid
is nil
, it also returns None
.source§fn parse_decimal(&self, key: &str) -> Option<Result<Decimal, Error>>
fn parse_decimal(&self, key: &str) -> Option<Result<Decimal, Error>>
Extracts the string corresponding to the key and parses it as
Decimal
.source§fn parse_date(&self, key: &str) -> Option<Result<Date, ParseError>>
fn parse_date(&self, key: &str) -> Option<Result<Date, ParseError>>
Extracts the string corresponding to the key and parses it as
Date
.source§fn parse_time(&self, key: &str) -> Option<Result<Time, ParseError>>
fn parse_time(&self, key: &str) -> Option<Result<Time, ParseError>>
Extracts the string corresponding to the key and parses it as
Time
.source§fn parse_datetime(&self, key: &str) -> Option<Result<DateTime, ParseError>>
fn parse_datetime(&self, key: &str) -> Option<Result<DateTime, ParseError>>
Extracts the string corresponding to the key and parses it as
DateTime
.source§fn parse_duration(
&self,
key: &str
) -> Option<Result<Duration, ParseDurationError>>
fn parse_duration( &self, key: &str ) -> Option<Result<Duration, ParseDurationError>>
Extracts the string corresponding to the key and parses it as
Duration
.source§fn parse_url(&self, key: &str) -> Option<Result<Url, ParseError>>
fn parse_url(&self, key: &str) -> Option<Result<Url, ParseError>>
Extracts the string corresponding to the key and parses it as
Url
.source§fn parse_ip(&self, key: &str) -> Option<Result<IpAddr, AddrParseError>>
fn parse_ip(&self, key: &str) -> Option<Result<IpAddr, AddrParseError>>
Extracts the string corresponding to the key and parses it as
IpAddr
.source§fn parse_ipv4(&self, key: &str) -> Option<Result<Ipv4Addr, AddrParseError>>
fn parse_ipv4(&self, key: &str) -> Option<Result<Ipv4Addr, AddrParseError>>
Extracts the string corresponding to the key and parses it as
Ipv4Addr
.source§fn parse_ipv6(&self, key: &str) -> Option<Result<Ipv6Addr, AddrParseError>>
fn parse_ipv6(&self, key: &str) -> Option<Result<Ipv6Addr, AddrParseError>>
Extracts the string corresponding to the key and parses it as
Ipv6Addr
.source§fn parse_model<M: Model>(&self, key: &str) -> Option<Result<M, Validation>>
fn parse_model<M: Model>(&self, key: &str) -> Option<Result<M, Validation>>
Extracts the value corresponding to the key and parses it as a model
M
.source§fn pointer(&self, pointer: &str) -> Option<&JsonValue>
fn pointer(&self, pointer: &str) -> Option<&JsonValue>
Looks up a value by a JSON Pointer. Read more
source§fn upsert(
&mut self,
key: impl Into<String>,
value: impl Into<JsonValue>
) -> Option<JsonValue>
fn upsert( &mut self, key: impl Into<String>, value: impl Into<JsonValue> ) -> Option<JsonValue>
Inserts or updates a pair into the map.
If the map did have this key present, the value is updated and the old value is returned,
otherwise
None
is returned.source§fn clone_from_populated(&mut self, key: &str, fields: &[&str])
fn clone_from_populated(&mut self, key: &str, fields: &[&str])
Copies values from the populated data corresponding to the key into
self
.source§fn extract_from_populated(&mut self, key: &str, fields: &[&str])
fn extract_from_populated(&mut self, key: &str, fields: &[&str])
Extracts values from the populated data corresponding to the key and moves them to
self
.source§fn translate_with_openapi(&mut self, name: &str)
fn translate_with_openapi(&mut self, name: &str)
Translates the map with the OpenAPI data.
source§fn read_as_model<M: Model>(&self) -> Result<M, Validation>
fn read_as_model<M: Model>(&self) -> Result<M, Validation>
Attempts to read the map as an instance of the model
M
.source§fn to_query_string(&self) -> String
fn to_query_string(&self) -> String
Serializes the map into a query string.
source§fn into_avro_record(self) -> Record
fn into_avro_record(self) -> Record
Consumes
self
and constructs an Avro record value.source§fn from_entry(key: impl Into<String>, value: impl Into<JsonValue>) -> Self
fn from_entry(key: impl Into<String>, value: impl Into<JsonValue>) -> Self
Creates a new instance with the entry.
source§fn from_entries(entries: JsonValue) -> Self
fn from_entries(entries: JsonValue) -> Self
Creates a new instance from the entries.
If the JSON value is not an object, an empty map will be returned.
source§fn data_entry(value: Map) -> Self
fn data_entry(value: Map) -> Self
Creates a new instance with a single key
entry
.source§fn data_entries(values: Vec<Map>) -> Self
fn data_entries(values: Vec<Map>) -> Self
Creates a new instance with the
entries
.