Skip to main content

qail_core/ast/
conditions.rs

1use crate::ast::{Expr, Operator, Value};
2use serde::{Deserialize, Serialize};
3
4/// A single condition within a cage.
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct Condition {
7    pub left: Expr,
8    pub op: Operator,
9    pub value: Value,
10    #[serde(default)]
11    pub is_array_unnest: bool,
12}
13
14impl std::fmt::Display for Condition {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        write!(f, "{} {} {}", self.left, self.op.sql_symbol(), self.value)
17    }
18}