pub enum Value {
Show 26 variants
Bool(bool),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
I128(i128),
U8(u8),
U16(u16),
U32(u32),
U64(u64),
U128(u128),
F32(f32),
F64(f64),
Decimal(Decimal),
Str(String),
Bytea(Vec<u8>),
Inet(IpAddr),
Date(NaiveDate),
Timestamp(NaiveDateTime),
Time(NaiveTime),
Interval(Interval),
Uuid(u128),
Map(BTreeMap<String, Value>),
List(Vec<Value>),
Point(Point),
Null,
}Variants§
Bool(bool)
I8(i8)
I16(i16)
I32(i32)
I64(i64)
I128(i128)
U8(u8)
U16(u16)
U32(u32)
U64(u64)
U128(u128)
F32(f32)
F64(f64)
Decimal(Decimal)
Str(String)
Bytea(Vec<u8>)
Inet(IpAddr)
Date(NaiveDate)
Timestamp(NaiveDateTime)
Time(NaiveTime)
Interval(Interval)
Uuid(u128)
Map(BTreeMap<String, Value>)
List(Vec<Value>)
Point(Point)
Null
Implementations§
Source§impl Value
impl Value
pub fn parse_json_map(value: &str) -> Result<Value>
pub fn parse_json_list(value: &str) -> Result<Value>
Source§impl Value
impl Value
pub fn evaluate_eq(&self, other: &Value) -> Tribool
pub fn evaluate_cmp(&self, other: &Value) -> Option<Ordering>
pub fn is_zero(&self) -> bool
pub fn get_type(&self) -> Option<DataType>
pub fn validate_type(&self, data_type: &DataType) -> Result<()>
pub fn validate_null(&self, nullable: bool) -> Result<()>
pub fn cast(&self, data_type: &DataType) -> Result<Self>
pub fn concat(self, other: Value) -> Value
pub fn add(&self, other: &Value) -> Result<Value>
pub fn subtract(&self, other: &Value) -> Result<Value>
pub fn multiply(&self, other: &Value) -> Result<Value>
pub fn divide(&self, other: &Value) -> Result<Value>
pub fn bitwise_and(&self, other: &Value) -> Result<Value>
pub fn modulo(&self, other: &Value) -> Result<Value>
pub fn bitwise_shift_left(&self, rhs: &Value) -> Result<Value>
pub fn bitwise_shift_right(&self, rhs: &Value) -> Result<Value>
pub fn is_null(&self) -> bool
pub fn unary_plus(&self) -> Result<Value>
pub fn unary_minus(&self) -> Result<Value>
pub fn unary_factorial(&self) -> Result<Value>
pub fn unary_bitwise_not(&self) -> Result<Value>
pub fn like(&self, other: &Value, case_sensitive: bool) -> Result<Value>
pub fn extract(&self, date_type: &DateTimeField) -> Result<Value>
pub fn sqrt(&self) -> Result<Value>
Sourcepub fn to_cmp_be_bytes(&self) -> Result<Vec<u8>>
pub fn to_cmp_be_bytes(&self) -> Result<Vec<u8>>
Value to Big-Endian for comparison purpose
Sourcepub fn position(&self, other: &Value) -> Result<Value>
pub fn position(&self, other: &Value) -> Result<Value>
§Description
The operation method differs depending on the argument.
-
If both arguments are String
- Support only
Value::Strvariant - Returns the position where the first letter of the substring starts if the string contains a substring.
- Returns
Value::I640 if the string to be found is not found. - Returns minimum value
Value::I641 when the string is found. - Returns
Value::Nullif NULL parameter found.
- Support only
-
Other arguments
- Not Supported Yet.
§Examples
use gluesql_core::prelude::Value;
let str1 = Value::Str("ramen".to_owned());
let str2 = Value::Str("men".to_owned());
assert_eq!(str1.position(&str2), Ok(Value::I64(3)));
assert_eq!(str2.position(&str1), Ok(Value::I64(0)));
assert!(Value::Null.position(&str2).unwrap().is_null());
assert!(str1.position(&Value::Null).unwrap().is_null());pub fn find_idx(&self, sub_val: &Value, start: &Value) -> Result<Value>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd<Value> for Decimal
impl PartialOrd<Value> for Decimal
Source§impl PartialOrd<Value> for f32
impl PartialOrd<Value> for f32
Source§impl PartialOrd<Value> for f64
impl PartialOrd<Value> for f64
Source§impl PartialOrd<Value> for i128
impl PartialOrd<Value> for i128
Source§impl PartialOrd<Value> for i16
impl PartialOrd<Value> for i16
Source§impl PartialOrd<Value> for i32
impl PartialOrd<Value> for i32
Source§impl PartialOrd<Value> for i64
impl PartialOrd<Value> for i64
Source§impl PartialOrd<Value> for i8
impl PartialOrd<Value> for i8
Source§impl PartialOrd<Value> for u128
impl PartialOrd<Value> for u128
Source§impl PartialOrd<Value> for u16
impl PartialOrd<Value> for u16
Source§impl PartialOrd<Value> for u32
impl PartialOrd<Value> for u32
Source§impl PartialOrd<Value> for u64
impl PartialOrd<Value> for u64
Source§impl PartialOrd<Value> for u8
impl PartialOrd<Value> for u8
Source§impl TryFrom<&Value> for NaiveDateTime
impl TryFrom<&Value> for NaiveDateTime
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§fn try_from(v: &Value) -> Result<NaiveDateTime, ValueError>
fn try_from(v: &Value) -> Result<NaiveDateTime, ValueError>
Performs the conversion.
Source§impl TryFrom<&Value> for bool
impl TryFrom<&Value> for bool
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for Decimal
impl TryFrom<Value> for Decimal
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for bool
impl TryFrom<Value> for bool
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for f32
impl TryFrom<Value> for f32
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for f64
impl TryFrom<Value> for f64
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for i128
impl TryFrom<Value> for i128
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for i16
impl TryFrom<Value> for i16
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for i32
impl TryFrom<Value> for i32
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for i64
impl TryFrom<Value> for i64
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for i8
impl TryFrom<Value> for i8
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for u128
impl TryFrom<Value> for u128
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for u16
impl TryFrom<Value> for u16
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for u32
impl TryFrom<Value> for u32
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for u64
impl TryFrom<Value> for u64
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for u8
impl TryFrom<Value> for u8
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
Source§impl TryFrom<Value> for usize
impl TryFrom<Value> for usize
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more