gitql_ast/types/
text.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use std::any::Any;

use super::base::DataType;

#[derive(Clone)]
pub struct TextType;

impl DataType for TextType {
    fn literal(&self) -> String {
        "Text".to_string()
    }

    fn equals(&self, other: &Box<dyn DataType>) -> bool {
        other.is_any() || other.is_text() || other.is_variant_with(|t| t.is_text())
    }

    fn as_any(&self) -> &dyn Any {
        self
    }

    fn can_perform_eq_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_gt_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_gte_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_lt_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_lte_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_like_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_glob_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }

    fn can_perform_regexp_op_with(&self) -> Vec<Box<dyn DataType>> {
        vec![Box::new(TextType)]
    }
}