use std::borrow::Cow;
use sonic_rs::Value;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SliceIndex {
Index(isize),
Slice {
start: Option<isize>,
stop: Option<isize>,
step: Option<isize>,
},
}
#[derive(Debug, Clone, PartialEq)]
pub enum FilterOp {
Exists,
NotExists,
Eq(Value),
Ne(Value),
Lt(f64),
Le(f64),
Gt(f64),
Ge(f64),
}
#[derive(Debug, Clone, PartialEq)]
pub struct FilterExpr<'a> {
pub path: Vec<Cow<'a, str>>,
pub op: FilterOp,
}
#[derive(Debug, Clone, PartialEq)]
pub enum PathSegment<'a> {
Root,
Field(Cow<'a, str>),
MultiField(Vec<Cow<'a, str>>),
Index(isize),
MultiIndex(Vec<SliceIndex>),
Wildcard,
Filter(FilterExpr<'a>),
Recursive(Box<PathSegment<'a>>),
}