#[derive(Debug, Clone)]
pub struct Query {
pub pattern: Pattern,
pub where_clause: Option<Condition>,
pub return_vars: Vec<String>,
}
#[derive(Debug, Clone)]
pub struct Pattern {
pub nodes: Vec<NodePattern>,
pub edges: Vec<EdgePattern>,
}
#[derive(Debug, Clone)]
pub struct NodePattern {
pub var: Option<String>,
pub props: Vec<PropFilter>,
}
#[derive(Debug, Clone)]
pub struct PropFilter {
pub key: String,
pub value: LitValue,
}
#[derive(Debug, Clone)]
pub struct EdgePattern {
pub label: Option<String>,
}
#[derive(Debug, Clone)]
pub enum Condition {
Compare { left: Expr, op: CompOp, right: Expr },
And(Box<Condition>, Box<Condition>),
Or(Box<Condition>, Box<Condition>),
}
#[derive(Debug, Clone)]
pub enum Expr {
Property { var: String, field: String },
Literal(LitValue),
}
#[derive(Debug, Clone)]
pub enum LitValue {
Int(i64),
Float(f64),
Str(String),
Bool(bool),
}
#[derive(Debug, Clone, Copy)]
pub enum CompOp {
Eq, Ne, Gt, Gte, Lt, Lte, }