Trait DataType

Source
pub trait DataType: DynClone {
Show 61 methods // Required methods fn literal(&self) -> String; fn as_any(&self) -> &dyn Any; // Provided methods fn equals(&self, other: &Box<dyn DataType>) -> bool { ... } fn can_perform_add_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn add_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_sub_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn sub_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_mul_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn mul_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_div_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn div_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_rem_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn rem_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_caret_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn caret_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType> { ... } fn can_perform_or_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn or_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_and_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn and_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_xor_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn xor_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_shl_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn shl_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_shr_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn shr_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType> { ... } fn can_perform_logical_or_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn logical_or_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType> { ... } fn can_perform_logical_and_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn logical_and_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType> { ... } fn can_perform_logical_xor_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn logical_xor_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType> { ... } fn can_perform_index_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn index_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType> { ... } fn can_perform_slice_op(&self) -> bool { ... } fn can_perform_slice_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_null_safe_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_null_safe_eq_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_gt_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_gt_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_gte_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_gte_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_lt_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_lt_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_lte_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_group_lte_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_not_op(&self) -> bool { ... } fn not_op_result_type(&self) -> Box<dyn DataType> { ... } fn can_perform_neg_op(&self) -> bool { ... } fn neg_op_result_type(&self) -> Box<dyn DataType> { ... } fn can_perform_bang_op(&self) -> bool { ... } fn bang_op_result_type(&self) -> Box<dyn DataType> { ... } fn can_perform_contains_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn has_implicit_cast_from(&self, expr: &Box<dyn Expr>) -> bool { ... } fn can_perform_explicit_cast_op_to(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_like_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_glob_op_with(&self) -> Vec<Box<dyn DataType>> { ... } fn can_perform_regexp_op_with(&self) -> Vec<Box<dyn DataType>> { ... }
}
Expand description

The in memory representation of the Data type in the GitQL query engine

Required Methods§

Source

fn literal(&self) -> String

Return the literal representation for this DataType

Source

fn as_any(&self) -> &dyn Any

Return the current value as dynamic Any

Provided Methods§

Source

fn equals(&self, other: &Box<dyn DataType>) -> bool

Return if other DataType is equal or not to current Type

Source

fn can_perform_add_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform + operator with between current DataType and any one of them

Source

fn add_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform = operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_sub_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform - operator with between current DataType and any one of them

Source

fn sub_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform - operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_mul_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform * operator with between current DataType and any one of them

Source

fn mul_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform * operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_div_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform / operator with between current DataType and any one of them

Source

fn div_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform / operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_rem_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform % operator with between current DataType and any one of them

Source

fn rem_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform & operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_caret_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform ^ operator with between current DataType and any one of them

Source

fn caret_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform ^ operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_or_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform | operator with between current DataType and any one of them

Source

fn or_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform | operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_and_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform & operator with between current DataType and any one of them

Source

fn and_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform & operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_xor_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform # operator with between current DataType and any one of them

Source

fn xor_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform # operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_shl_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform << operator with between current DataType and any one of them

Source

fn shl_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform << operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_shr_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform >> operator with between current DataType and any one of them

Source

fn shr_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform >> operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_logical_or_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform || or OR operator with between current DataType and any one of them

Source

fn logical_or_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType>

Return the expected type after perform || or OR operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_logical_and_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform && or AND operator with between current DataType and any one of them

Source

fn logical_and_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType>

Return the expected type after perform && or AND operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_logical_xor_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `XOR’ operator with between current DataType and any one of them

Source

fn logical_xor_op_result_type( &self, other: &Box<dyn DataType>, ) -> Box<dyn DataType>

Return the expected type after perform ‘XOR’ operator between current type and argument type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_index_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `[I]’ operator with between current DataType and any one of them

Source

fn index_op_result_type(&self, other: &Box<dyn DataType>) -> Box<dyn DataType>

Return the expected type after perform ‘[]’ operator on current type

  • other - The index type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_slice_op(&self) -> bool

Return true if this type support Slice operator with

Source

fn can_perform_slice_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `[S : E]’ operator with between current DataType and any one of them

Source

fn can_perform_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `=’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `= [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform !=' or <>` operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `!= [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_null_safe_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `<=>’ operator with between current DataType and any one of them

No need to define the result type, it always IntType

Source

fn can_perform_group_null_safe_eq_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `<=> [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always IntType

Source

fn can_perform_gt_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `>’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_gt_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `> [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_gte_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `>=’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_gte_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `>= [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_lt_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `<’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_lt_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `< [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_lte_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `=<’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_group_lte_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `<= [ALL|ANY|SOME]’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_not_op(&self) -> bool

Return a list of types that it’s possible to perform unary `NOT’ operator with between current DataType and any one of them

Source

fn not_op_result_type(&self) -> Box<dyn DataType>

Return the expected type after perform unary `NOT’ operator on current type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_neg_op(&self) -> bool

Return a list of types that it’s possible to perform unary `-’ operator with between current DataType and any one of them

Source

fn neg_op_result_type(&self) -> Box<dyn DataType>

Return the expected type after perform unary `-’ operator on current type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_bang_op(&self) -> bool

Return a list of types that it’s possible to perform unary `!’ operator with between current DataType and any one of them

Source

fn bang_op_result_type(&self) -> Box<dyn DataType>

Return the expected type after perform unary `!’ operator on current type

Note that you don’t need to check again that the argument type is possible to perform operator with

Source

fn can_perform_contains_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform unary `@>’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn has_implicit_cast_from(&self, expr: &Box<dyn Expr>) -> bool

Return true if this Expression can be casted to the current type without any evaluation

For example casting Text with specific format to Date or Time

The result type is equal to the current type

Source

fn can_perform_explicit_cast_op_to(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform `Cast’ operator to

For example casting column with float value to integer or verse versa

The result type is equal to the current type

Source

fn can_perform_like_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform unary `LIKE’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_glob_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform unary `GLOB’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Source

fn can_perform_regexp_op_with(&self) -> Vec<Box<dyn DataType>>

Return a list of types that it’s possible to perform unary `REGEXP’ operator with between current DataType and any one of them

No need to define the result type, it always BoolType

Implementations§

Source§

impl dyn DataType

Source

pub fn is_any(&self) -> bool

Return true if this type is AnyType

Source

pub fn is_text(&self) -> bool

Return true if this type is TextType

Source

pub fn is_int(&self) -> bool

Return true if this type is IntType

Source

pub fn is_float(&self) -> bool

Return true if this type is FloatType

Source

pub fn is_number(&self) -> bool

Return true if this type is IntType or FloatType

Source

pub fn is_bool(&self) -> bool

Return true if this type is BoolType

Source

pub fn is_date(&self) -> bool

Return true if this type is DateType

Source

pub fn is_time(&self) -> bool

Return true if this type is TimeType

Source

pub fn is_date_time(&self) -> bool

Return true if this type is DateTimeType

Source

pub fn is_interval(&self) -> bool

Return true if this type is IntervalType

Source

pub fn is_array(&self) -> bool

Return true if this type is ArrayType

Source

pub fn is_range(&self) -> bool

Return true if this type is RangeType

Source

pub fn is_variant(&self) -> bool

Return true if this type is VariantType

Source

pub fn is_variant_with(&self, matcher: fn(&Box<dyn DataType>) -> bool) -> bool

Return true if this type is VariantType and applying the matcher function is return true on one of the variants

Source

pub fn is_variant_contains(&self, other: &Box<dyn DataType>) -> bool

Return true if this type is VariantType and contain specific type as one of it variants

Source

pub fn is_optional(&self) -> bool

Return true if this type is OptionType

Source

pub fn is_varargs(&self) -> bool

Return true if this type is VarargsType

Source

pub fn is_composite(&self) -> bool

Return true if this type is CompositeType

Source

pub fn is_undefined(&self) -> bool

Return true if this type is UndefType

Source

pub fn is_null(&self) -> bool

Return true if this type is NullType

Trait Implementations§

Source§

impl Display for Box<dyn DataType>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Box<dyn DataType>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§