use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
pub enum BinaryOperator {
Add, Sub, Mul, Div, And, Or, Lt, Gt, Lte, Gte, Eq, Neq, Like, NotLike, In, NotIn, Is, IsNot, }
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
pub enum UnaryOperator {
Pos, Neg, Not, }
impl BinaryOperator {
pub fn get_precedence(&self) -> i32 {
match self {
BinaryOperator::Add => 10,
BinaryOperator::Sub => 10,
BinaryOperator::Mul => 40,
BinaryOperator::Div => 40,
BinaryOperator::And => 10,
BinaryOperator::Or => 10,
BinaryOperator::Lt => 10,
BinaryOperator::Gt => 10,
BinaryOperator::Lte => 10,
BinaryOperator::Gte => 10,
BinaryOperator::Eq => 10,
BinaryOperator::Neq => 10,
BinaryOperator::Like => 10,
BinaryOperator::NotLike => 10,
BinaryOperator::In => 10,
BinaryOperator::NotIn => 10,
BinaryOperator::Is => 10,
BinaryOperator::IsNot => 10,
}
}
}