pub enum Query {
Field(String),
Index(usize),
Range(Option<usize>, Option<usize>),
RangeFrom(usize),
FieldWildcard,
ArrayWildcard,
Regex(String),
Optional(Box<Self>),
KleeneStar(Box<Self>),
Disjunction(Vec<Self>),
Sequence(Vec<Self>),
}Expand description
The Query enum represents the different types of queries that can be
constructed
Variants§
Field(String)
Field access by exact name, e.g., “foo”
Index(usize)
Array index access (0-based), e.g, “[3]”)
Range(Option<usize>, Option<usize>)
Array range access with start and end: “[3:5]”
NOTE: The end index is exclusive, so the range is start..end.
RangeFrom(usize)
Array range access from a starting index, e.g., “foo[3:]”
FieldWildcard
Wildcard field access, e.g., “foo.*”. Represents a single-level field wildcard access and not a recursive descent.
ArrayWildcard
Wildcard array access, e.g., “foo[*]”
Regex(String)
Regex access, e.g., “/regex/”
Optional(Box<Self>)
Optional access, e.g., “?” This represents an optional query that may or may not match.
KleeneStar(Box<Self>)
Kleene star, e.g., “foo*”
Disjunction(Vec<Self>)
Disjunction, e.g., “foo | bar” This represents a logical OR between an arbitrary number of queries.
Sequence(Vec<Self>)
Sequence, e.g., “foo.bar” A wrapper for a sequence of queries that can be executed in order.