pub struct PartiqlMetadata<T>{ /* private fields */ }Expand description
Provides a mean to store meta-data for PartiQL objects.
§Examples
use partiql_common::metadata::{PartiqlMetadata, PartiqlMetaValue};
let foo_val = PartiqlMetaValue::String("foo".to_string());
let i64_val = PartiqlMetaValue::Int64(2);///
let expected_vec_val = vec![foo_val, i64_val];
let expected_bool_val = true;///
let expected_int_val = 2;///
let expected_float_val = 2.5;///
let expected_str_val = "foo";///
let mut expected_map = PartiqlMetadata::new();///
expected_map.insert("bool value", expected_bool_val.into());///
expected_map.insert("integer value", expected_int_val.into());///
let mut metas = PartiqlMetadata::new();///
metas.insert("vec value", expected_vec_val.clone().into());
metas.insert("bool value", expected_bool_val.into());///
metas.insert("integer value", expected_int_val.into());///
metas.insert("float value", expected_float_val.into());///
metas.insert("string value", expected_str_val.into());///
metas.insert("map value", expected_map.clone().into());///
let vec_val = metas.vec_value("vec value").expect("vec meta value");///
let bool_val = metas.bool_value("bool value").expect("bool meta value");///
let int_val = metas.i32_value("integer value").expect("i32 meta value");///
let float_val = metas.f64_value("float value").expect("f64 meta value");///
let string_val = metas.string_value("string value").expect("string meta value");///
let map_val = metas.map_value("map value").expect("map meta value");///
assert_eq!(vec_val, expected_vec_val.clone());///
assert_eq!(bool_val, expected_bool_val.clone());///
assert_eq!(int_val, expected_int_val.clone());///
assert_eq!(float_val, expected_float_val.clone());///
assert_eq!(string_val, expected_str_val);///
assert_eq!(map_val, expected_map.clone());Implementations§
Source§impl<T> PartiqlMetadata<T>
impl<T> PartiqlMetadata<T>
pub fn new() -> Self
pub fn insert(&mut self, key: T, value: PartiqlMetaValue<T>)
pub fn get(&self, key: &T) -> Option<&PartiqlMetaValue<T>>
pub fn get_mut(&mut self, key: &T) -> Option<&mut PartiqlMetaValue<T>>
pub fn contains_key(&self, key: &T) -> bool
pub fn keys(&self) -> impl Iterator<Item = &T>
pub fn values(&self) -> impl Iterator<Item = &PartiqlMetaValue<T>>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut PartiqlMetaValue<T>>
pub fn entry(&mut self, key: T) -> Entry<'_, T, PartiqlMetaValue<T>>
pub fn clear(&mut self)
pub fn remove(&mut self, key: &T) -> Option<PartiqlMetaValue<T>>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&T, &PartiqlMetaValue<T>)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&T, &mut PartiqlMetaValue<T>)>
pub fn vec_value(&self, key: &str) -> Option<Vec<PartiqlMetaValue<T>>>
pub fn bool_value(&self, key: &str) -> Option<bool>
pub fn f32_value(&self, key: &str) -> Option<f32>
pub fn f64_value(&self, key: &str) -> Option<f64>
pub fn decimal_value(&self, key: &str) -> Option<Decimal>
pub fn i32_value(&self, key: &str) -> Option<i32>
pub fn i64_value(&self, key: &str) -> Option<i64>
pub fn map_value(&self, key: &str) -> Option<PartiqlMetadata<T>>
pub fn string_value(&self, key: &str) -> Option<String>
Trait Implementations§
Source§impl<T> Clone for PartiqlMetadata<T>
impl<T> Clone for PartiqlMetadata<T>
Source§fn clone(&self) -> PartiqlMetadata<T>
fn clone(&self) -> PartiqlMetadata<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for PartiqlMetadata<T>
impl<T> Debug for PartiqlMetadata<T>
Source§impl<T> Default for PartiqlMetadata<T>
impl<T> Default for PartiqlMetadata<T>
Source§impl<T> From<PartiqlMetadata<T>> for PartiqlMetaValue<T>
impl<T> From<PartiqlMetadata<T>> for PartiqlMetaValue<T>
Source§fn from(value: PartiqlMetadata<T>) -> Self
fn from(value: PartiqlMetadata<T>) -> Self
Converts to this type from the input type.
Source§impl<T> FromIterator<(T, PartiqlMetaValue<T>)> for PartiqlMetadata<T>
impl<T> FromIterator<(T, PartiqlMetaValue<T>)> for PartiqlMetadata<T>
Source§fn from_iter<I: IntoIterator<Item = (T, PartiqlMetaValue<T>)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (T, PartiqlMetaValue<T>)>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<T> IntoIterator for PartiqlMetadata<T>
impl<T> IntoIterator for PartiqlMetadata<T>
Source§impl<T> PartialEq for PartiqlMetadata<T>
impl<T> PartialEq for PartiqlMetadata<T>
impl<T> StructuralPartialEq for PartiqlMetadata<T>
Auto Trait Implementations§
impl<T> Freeze for PartiqlMetadata<T>
impl<T> RefUnwindSafe for PartiqlMetadata<T>where
T: RefUnwindSafe,
impl<T> Send for PartiqlMetadata<T>where
T: Send,
impl<T> Sync for PartiqlMetadata<T>where
T: Sync,
impl<T> Unpin for PartiqlMetadata<T>where
T: Unpin,
impl<T> UnwindSafe for PartiqlMetadata<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more