icydb_core/db/query/predicate/
ast.rs1use crate::value::Value;
2
3use super::coercion::CoercionSpec;
4
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
23pub enum CompareOp {
24 Eq,
25 Ne,
26 Lt,
27 Lte,
28 Gt,
29 Gte,
30 In,
31 NotIn,
32 AnyIn,
33 AllIn,
34 Contains,
35 StartsWith,
36 EndsWith,
37}
38
39#[derive(Clone, Debug, Eq, PartialEq)]
44pub struct ComparePredicate {
45 pub field: String,
46 pub op: CompareOp,
47 pub value: Value,
48 pub coercion: CoercionSpec,
49}
50
51#[derive(Clone, Debug, Eq, PartialEq)]
56pub enum Predicate {
57 True,
58 False,
59 And(Vec<Self>),
60 Or(Vec<Self>),
61 Not(Box<Self>),
62 Compare(ComparePredicate),
63 IsNull {
64 field: String,
65 },
66 IsMissing {
67 field: String,
68 },
69 IsEmpty {
70 field: String,
71 },
72 IsNotEmpty {
73 field: String,
74 },
75 MapContainsKey {
76 field: String,
77 key: Value,
78 coercion: CoercionSpec,
79 },
80 MapContainsValue {
81 field: String,
82 value: Value,
83 coercion: CoercionSpec,
84 },
85 MapContainsEntry {
86 field: String,
87 key: Value,
88 value: Value,
89 coercion: CoercionSpec,
90 },
91}