qail_core/ast/cages.rs
1use crate::ast::{Condition, LogicalOp, SortOrder};
2use serde::{Deserialize, Serialize};
3
4/// A cage (constraint block) in the query.
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct Cage {
7 /// The type of cage
8 pub kind: CageKind,
9 /// Conditions within this cage
10 pub conditions: Vec<Condition>,
11 /// Logical operator between conditions (AND or OR)
12 pub logical_op: LogicalOp,
13}
14
15/// The type of cage.
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
17pub enum CageKind {
18 /// WHERE filter
19 Filter,
20 /// SET payload (for updates)
21 Payload,
22 /// ORDER BY
23 Sort(SortOrder),
24 /// LIMIT
25 Limit(usize),
26 /// OFFSET
27 Offset(usize),
28 /// TABLESAMPLE - percentage of rows
29 Sample(usize),
30 /// QUALIFY - filter on window function results
31 Qualify,
32 /// PARTITION BY - window function partitioning
33 Partition,
34}