1use std::fmt;
14
15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
17pub enum UnaryOperator {
18 Plus,
19 Minus,
20 Not,
21}
22
23impl fmt::Display for UnaryOperator {
24 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25 f.write_str(match self {
26 UnaryOperator::Plus => "+",
27 UnaryOperator::Minus => "-",
28 UnaryOperator::Not => "NOT",
29 })
30 }
31}
32
33#[derive(Debug, Clone, PartialEq, Eq, Hash)]
35pub enum BinaryOperator {
36 Plus,
37 Minus,
38 Multiply,
39 Divide,
40 Modulus,
41 Gt,
42 Lt,
43 GtEq,
44 LtEq,
45 Eq,
46 NotEq,
47 And,
48 Or,
49 Like,
50 Ilike,
51 NotLike,
52 In,
53}
54
55impl fmt::Display for BinaryOperator {
56 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
57 f.write_str(match self {
58 BinaryOperator::Plus => "+",
59 BinaryOperator::Minus => "-",
60 BinaryOperator::Multiply => "*",
61 BinaryOperator::Divide => "/",
62 BinaryOperator::Modulus => "%",
63 BinaryOperator::Gt => ">",
64 BinaryOperator::Lt => "<",
65 BinaryOperator::GtEq => ">=",
66 BinaryOperator::LtEq => "<=",
67 BinaryOperator::Eq => "=",
68 BinaryOperator::NotEq => "<>",
69 BinaryOperator::And => "AND",
70 BinaryOperator::Or => "OR",
71 BinaryOperator::Like => "LIKE",
72 BinaryOperator::Ilike => "ILIKE",
73 BinaryOperator::NotLike => "NOT LIKE",
74 BinaryOperator::In => "IN",
75 })
76 }
77}