pub enum DbValue {
Bytes(Vec<u8>),
I64(i64),
U64(u64),
F64(DbF64),
String(String),
VecI64(Vec<i64>),
VecU64(Vec<u64>),
VecF64(Vec<DbF64>),
VecString(Vec<String>),
}Expand description
Database value is a strongly types value.
It is an enum of limited number supported types that are universal across all platforms and programming languages.
The value is constructible from large number of
raw types or associated types (e.g. i32, &str, etc.).
Getting the raw value back as string can be done
with to_string() but otherwise requires a match.
Variants§
Bytes(Vec<u8>)
Byte array, sometimes referred to as blob
I64(i64)
64-bit wide signed integer
U64(u64)
64-bit wide unsigned integer
F64(DbF64)
64-bit floating point number
String(String)
UTF-8 string
VecI64(Vec<i64>)
List of 64-bit wide signed integers
VecU64(Vec<u64>)
List of 64-bit wide unsigned integers
VecF64(Vec<DbF64>)
List of 64-bit floating point numbers
VecString(Vec<String>)
List of UTF-8 strings
Implementations§
source§impl DbValue
impl DbValue
sourcepub fn bytes(&self) -> Result<&Vec<u8>, DbError>
pub fn bytes(&self) -> Result<&Vec<u8>, DbError>
Returns &Vec<u8> or an error if the value is
of a different type.
sourcepub fn string(&self) -> Result<&String, DbError>
pub fn string(&self) -> Result<&String, DbError>
Returns &String or an error if the value is
of a different type.
sourcepub fn to_f64(&self) -> Result<DbF64, DbError>
pub fn to_f64(&self) -> Result<DbF64, DbError>
Returns DbF64 possibly converted from i64 or u64
or na error if the conversion failed or the value is of
a different type.
sourcepub fn to_i64(&self) -> Result<i64, DbError>
pub fn to_i64(&self) -> Result<i64, DbError>
Returns i64 possibly converted from u64
or na error if the conversion failed or the value is of
a different type.
sourcepub fn to_u64(&self) -> Result<u64, DbError>
pub fn to_u64(&self) -> Result<u64, DbError>
Returns u64 possibly converted from i64
or na error if the conversion failed or the value is of
a different type.
sourcepub fn vec_f64(&self) -> Result<&Vec<DbF64>, DbError>
pub fn vec_f64(&self) -> Result<&Vec<DbF64>, DbError>
Returns &Vec<DbF64> or an error if the value is
of a different type.
sourcepub fn vec_i64(&self) -> Result<&Vec<i64>, DbError>
pub fn vec_i64(&self) -> Result<&Vec<i64>, DbError>
Returns &Vec<i64> or an error if the value is
of a different type.
Trait Implementations§
source§impl Ord for DbValue
impl Ord for DbValue
source§impl PartialEq for DbValue
impl PartialEq for DbValue
source§impl PartialOrd for DbValue
impl PartialOrd for DbValue
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more