Trait edm_core::extension::AvroRecordExt
source · pub trait AvroRecordExt {
Show 19 methods
// Required methods
fn get_bool(&self, key: &str) -> Option<bool>;
fn get_i32(&self, key: &str) -> Option<i32>;
fn get_i64(&self, key: &str) -> Option<i64>;
fn get_u16(&self, key: &str) -> Option<u16>;
fn get_u32(&self, key: &str) -> Option<u32>;
fn get_u64(&self, key: &str) -> Option<u64>;
fn get_usize(&self, key: &str) -> Option<usize>;
fn get_f32(&self, key: &str) -> Option<f32>;
fn get_f64(&self, key: &str) -> Option<f64>;
fn get_bytes(&self, key: &str) -> Option<&[u8]>;
fn get_str(&self, key: &str) -> Option<&str>;
fn contains_key(&self, key: &str) -> bool;
fn find(&self, key: &str) -> Option<&AvroValue>;
fn position(&self, key: &str) -> Option<usize>;
fn upsert(
&mut self,
key: impl Into<String>,
value: impl Into<AvroValue>
) -> Option<AvroValue>;
fn flush_to_writer<W: Write>(
self,
schema: &Schema,
writer: W
) -> Result<usize, Error>;
fn into_avro_map(self) -> HashMap<String, AvroValue>;
fn try_into_map(self) -> Result<Map, Error>;
fn from_entry(key: impl Into<String>, value: impl Into<AvroValue>) -> Self;
}Expand description
Extension trait for Record.
Required Methods§
sourcefn get_bool(&self, key: &str) -> Option<bool>
fn get_bool(&self, key: &str) -> Option<bool>
Extracts the boolean value corresponding to the key.
sourcefn get_i32(&self, key: &str) -> Option<i32>
fn get_i32(&self, key: &str) -> Option<i32>
Extracts the integer value corresponding to the key.
sourcefn get_i64(&self, key: &str) -> Option<i64>
fn get_i64(&self, key: &str) -> Option<i64>
Extracts the Long integer value corresponding to the key.
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn contains_key(&self, key: &str) -> bool
fn contains_key(&self, key: &str) -> bool
Returns true if the record contains a value for the key.
sourcefn upsert(
&mut self,
key: impl Into<String>,
value: impl Into<AvroValue>
) -> Option<AvroValue>
fn upsert( &mut self, key: impl Into<String>, value: impl Into<AvroValue> ) -> Option<AvroValue>
Inserts or updates a pair into the record.
If the record did have this key, the value is updated and the old value is returned,
otherwise None is returned.
sourcefn flush_to_writer<W: Write>(
self,
schema: &Schema,
writer: W
) -> Result<usize, Error>
fn flush_to_writer<W: Write>( self, schema: &Schema, writer: W ) -> Result<usize, Error>
Flushes the content appended to a writer with the given schema. Returns the number of bytes written.
sourcefn into_avro_map(self) -> HashMap<String, AvroValue>
fn into_avro_map(self) -> HashMap<String, AvroValue>
Converts self to an Avro map.
sourcefn try_into_map(self) -> Result<Map, Error>
fn try_into_map(self) -> Result<Map, Error>
Consumes self and attempts to construct a json object.