Enum tea_sdk::utils::wasm_actor::prelude::Value
pub enum Value {
}
Variants§
Bool(bool)
I8(i8)
I16(i16)
I32(i32)
I64(i64)
I128(i128)
U8(u8)
F64(f64)
Decimal(Decimal)
Str(String)
Bytea(Vec<u8>)
Date(NaiveDate)
Timestamp(NaiveDateTime)
Time(NaiveTime)
Interval(Interval)
Uuid(u128)
Map(HashMap<String, Value>)
List(Vec<Value>)
Null
Implementations§
§impl Value
impl Value
pub fn parse_json_map(value: &str) -> Result<Value, Error>
pub fn parse_json_list(value: &str) -> Result<Value, Error>
§impl Value
impl Value
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>
§impl Value
impl Value
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 modulo(&self, other: &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 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>
pub 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
pub 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::Str
variant - Returns the position where the first letter of the substring starts if the string contains a substring.
- Returns
Value::I64
0 if the string to be found is not found. - Returns minimum value
Value::I64
1 when the string is found. - Returns
Value::Null
if 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());
Trait Implementations§
§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
§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
§impl PartialEq<Literal<'_>> for Value
impl PartialEq<Literal<'_>> for Value
§impl PartialOrd<Literal<'_>> for Value
impl PartialOrd<Literal<'_>> for Value
§fn partial_cmp(&self, other: &Literal<'_>) -> Option<Ordering>
fn partial_cmp(&self, other: &Literal<'_>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl PartialOrd for Value
impl PartialOrd for Value
§fn partial_cmp(&self, other: &Value) -> Option<Ordering>
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Serialize for Value
impl Serialize for Value
§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
Auto Trait Implementations§
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