Enum gluesql_core::data::value::Value
source · 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 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_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>
pub fn try_cast_from_literal( data_type: &DataType, literal: &Literal<'_>, ) -> Result<Value>
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<()>
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 Decimal
impl TryFrom<&Value> for Decimal
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for IpAddr
impl TryFrom<&Value> for IpAddr
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for NaiveDate
impl TryFrom<&Value> for NaiveDate
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for NaiveDateTime
impl TryFrom<&Value> for NaiveDateTime
§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.
source§impl TryFrom<&Value> for NaiveTime
impl TryFrom<&Value> for NaiveTime
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for Point
impl TryFrom<&Value> for Point
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for bool
impl TryFrom<&Value> for bool
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for f32
impl TryFrom<&Value> for f32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for f64
impl TryFrom<&Value> for f64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for i128
impl TryFrom<&Value> for i128
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for i16
impl TryFrom<&Value> for i16
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for i32
impl TryFrom<&Value> for i32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for i64
impl TryFrom<&Value> for i64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for i8
impl TryFrom<&Value> for i8
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for u128
impl TryFrom<&Value> for u128
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for u16
impl TryFrom<&Value> for u16
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for u32
impl TryFrom<&Value> for u32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for u64
impl TryFrom<&Value> for u64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for u8
impl TryFrom<&Value> for u8
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<&Value> for usize
impl TryFrom<&Value> for usize
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for Decimal
impl TryFrom<Value> for Decimal
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for bool
impl TryFrom<Value> for bool
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for f32
impl TryFrom<Value> for f32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for f64
impl TryFrom<Value> for f64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for i128
impl TryFrom<Value> for i128
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for i16
impl TryFrom<Value> for i16
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for i32
impl TryFrom<Value> for i32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for i64
impl TryFrom<Value> for i64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for i8
impl TryFrom<Value> for i8
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for u128
impl TryFrom<Value> for u128
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for u16
impl TryFrom<Value> for u16
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for u32
impl TryFrom<Value> for u32
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for u64
impl TryFrom<Value> for u64
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for u8
impl TryFrom<Value> for u8
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
source§impl TryFrom<Value> for usize
impl TryFrom<Value> for usize
§type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
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<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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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