pub enum FieldValue {
Float(f64),
Integer(i64),
UnsignedInteger(u64),
String(String),
Boolean(bool),
Timestamp(DateTime<Utc>),
}
Expand description
Represent a field value
Variants§
Float(f64)
Represent a floating point number field value
Integer(i64)
Represent a signed integer number field value
UnsignedInteger(u64)
Represent an unsigned integer number field value
String(String)
Represent a string field value
Boolean(bool)
Represent a boolean field value
Timestamp(DateTime<Utc>)
Represent an instant field value
InfluxDB does not natively support instants as field values, so this is represented as a nanosecond timestamp.
Implementations§
Source§impl FieldValue
impl FieldValue
Sourcepub fn escape_to_line_protocol(&self) -> String
pub fn escape_to_line_protocol(&self) -> String
Escape a field value to InfluxDB line protocol
Numeric and boolean values are escaped as they are.
Timestamps are converted to nanoseconds from epoch.
Strings are enclosed in double quotes, and characters "
and \
are escaped.
let mut value = FieldValue::String("a string \"value\"".into());
assert_eq!(value.escape_to_line_protocol(), "\"a string \\\\\"value\\\\\"\"".to_string());
Trait Implementations§
Source§impl Clone for FieldValue
impl Clone for FieldValue
Source§fn clone(&self) -> FieldValue
fn clone(&self) -> FieldValue
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 Debug for FieldValue
impl Debug for FieldValue
Source§impl From<&str> for FieldValue
impl From<&str> for FieldValue
Source§impl From<String> for FieldValue
impl From<String> for FieldValue
Source§impl From<bool> for FieldValue
impl From<bool> for FieldValue
Source§impl From<f64> for FieldValue
impl From<f64> for FieldValue
Source§impl From<i64> for FieldValue
impl From<i64> for FieldValue
Source§impl From<u64> for FieldValue
impl From<u64> for FieldValue
Source§impl PartialEq for FieldValue
impl PartialEq for FieldValue
impl StructuralPartialEq for FieldValue
Auto Trait Implementations§
impl Freeze for FieldValue
impl RefUnwindSafe for FieldValue
impl Send for FieldValue
impl Sync for FieldValue
impl Unpin for FieldValue
impl UnwindSafe for FieldValue
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