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(HashMap<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(HashMap<String, Value>)
List(Vec<Value>)
Point(Point)
Null
Implementations§
Source§impl Value
impl Value
pub fn evaluate_eq_with_literal(&self, other: &Literal<'_>) -> bool
pub fn evaluate_cmp_with_literal(&self, other: &Literal<'_>) -> Option<Ordering>
pub fn try_from_literal( data_type: &DataType, literal: &Literal<'_>, ) -> Result<Value, Error>
pub fn try_cast_from_literal( data_type: &DataType, literal: &Literal<'_>, ) -> Result<Value, Error>
Source§impl Value
impl Value
pub fn evaluate_eq(&self, other: &Value) -> bool
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<(), Error>
pub fn validate_null(&self, nullable: bool) -> Result<(), Error>
pub fn cast(&self, data_type: &DataType) -> Result<Value, Error>
pub fn concat(self, other: Value) -> Value
pub fn add(&self, other: &Value) -> Result<Value, Error>
pub fn subtract(&self, other: &Value) -> Result<Value, Error>
pub fn multiply(&self, other: &Value) -> Result<Value, Error>
pub fn divide(&self, other: &Value) -> Result<Value, Error>
pub fn bitwise_and(&self, other: &Value) -> Result<Value, Error>
pub fn modulo(&self, other: &Value) -> Result<Value, Error>
pub fn bitwise_shift_left(&self, rhs: &Value) -> Result<Value, Error>
pub fn bitwise_shift_right(&self, rhs: &Value) -> Result<Value, Error>
pub fn is_null(&self) -> bool
pub fn unary_plus(&self) -> Result<Value, Error>
pub fn unary_minus(&self) -> Result<Value, Error>
pub fn unary_factorial(&self) -> Result<Value, Error>
pub fn unary_bitwise_not(&self) -> Result<Value, Error>
pub fn like(&self, other: &Value, case_sensitive: bool) -> Result<Value, Error>
pub fn extract(&self, date_type: &DateTimeField) -> Result<Value, Error>
pub fn sqrt(&self) -> Result<Value, Error>
Sourcepub fn to_cmp_be_bytes(&self) -> Result<Vec<u8>, Error>
pub fn to_cmp_be_bytes(&self) -> Result<Vec<u8>, Error>
Value to Big-Endian for comparison purpose
Sourcepub fn position(&self, other: &Value) -> Result<Value, Error>
pub fn position(&self, other: &Value) -> Result<Value, Error>
§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, Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd<Value> for u32
impl PartialOrd<Value> for u32
Source§impl Serialize for Value
impl Serialize for Value
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<&Value> for NaiveDateTime
impl TryFrom<&Value> for NaiveDateTime
Source§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
Source§fn try_from(v: &Value) -> Result<NaiveDateTime, ConvertError>
fn try_from(v: &Value) -> Result<NaiveDateTime, ConvertError>
Performs the conversion.
impl StructuralPartialEq 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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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