pub enum LogicalExpression {
Show 23 variants
Literal(Value),
Variable(String),
Property {
variable: String,
property: String,
},
Binary {
left: Box<LogicalExpression>,
op: BinaryOp,
right: Box<LogicalExpression>,
},
Unary {
op: UnaryOp,
operand: Box<LogicalExpression>,
},
FunctionCall {
name: String,
args: Vec<LogicalExpression>,
distinct: bool,
},
List(Vec<LogicalExpression>),
Map(Vec<(String, LogicalExpression)>),
IndexAccess {
base: Box<LogicalExpression>,
index: Box<LogicalExpression>,
},
SliceAccess {
base: Box<LogicalExpression>,
start: Option<Box<LogicalExpression>>,
end: Option<Box<LogicalExpression>>,
},
Case {
operand: Option<Box<LogicalExpression>>,
when_clauses: Vec<(LogicalExpression, LogicalExpression)>,
else_clause: Option<Box<LogicalExpression>>,
},
Parameter(String),
Labels(String),
Type(String),
Id(String),
ListComprehension {
variable: String,
list_expr: Box<LogicalExpression>,
filter_expr: Option<Box<LogicalExpression>>,
map_expr: Box<LogicalExpression>,
},
ListPredicate {
kind: ListPredicateKind,
variable: String,
list_expr: Box<LogicalExpression>,
predicate: Box<LogicalExpression>,
},
ExistsSubquery(Box<LogicalOperator>),
CountSubquery(Box<LogicalOperator>),
ValueSubquery(Box<LogicalOperator>),
MapProjection {
base: String,
entries: Vec<MapProjectionEntry>,
},
Reduce {
accumulator: String,
initial: Box<LogicalExpression>,
variable: String,
list: Box<LogicalExpression>,
expression: Box<LogicalExpression>,
},
PatternComprehension {
subplan: Box<LogicalOperator>,
projection: Box<LogicalExpression>,
},
}Expand description
A logical expression.
Variants§
Literal(Value)
A literal value.
Variable(String)
A variable reference.
Property
Property access (e.g., n.name).
Binary
Binary operation.
Unary
Unary operation.
FunctionCall
Function call.
Fields
args: Vec<LogicalExpression>Arguments.
List(Vec<LogicalExpression>)
List literal.
Map(Vec<(String, LogicalExpression)>)
Map literal (e.g., {name: ‘Alix’, age: 30}).
IndexAccess
Index access (e.g., list[0]).
Fields
base: Box<LogicalExpression>The base expression (typically a list or string).
index: Box<LogicalExpression>The index expression.
SliceAccess
Slice access (e.g., list[1..3]).
Fields
base: Box<LogicalExpression>The base expression (typically a list or string).
start: Option<Box<LogicalExpression>>Start index (None means from beginning).
end: Option<Box<LogicalExpression>>End index (None means to end).
Case
CASE expression.
Fields
operand: Option<Box<LogicalExpression>>Test expression (for simple CASE).
when_clauses: Vec<(LogicalExpression, LogicalExpression)>WHEN clauses.
else_clause: Option<Box<LogicalExpression>>ELSE clause.
Parameter(String)
Parameter reference.
Labels(String)
Labels of a node.
Type(String)
Type of an edge.
Id(String)
ID of a node or edge.
ListComprehension
List comprehension: [x IN list WHERE predicate | expression]
Fields
list_expr: Box<LogicalExpression>The source list expression.
filter_expr: Option<Box<LogicalExpression>>Optional filter predicate.
map_expr: Box<LogicalExpression>The mapping expression for each element.
ListPredicate
List predicate: all/any/none/single(x IN list WHERE pred).
Fields
kind: ListPredicateKindThe kind of list predicate.
list_expr: Box<LogicalExpression>The source list expression.
predicate: Box<LogicalExpression>The predicate to test for each element.
ExistsSubquery(Box<LogicalOperator>)
EXISTS subquery.
CountSubquery(Box<LogicalOperator>)
COUNT subquery.
ValueSubquery(Box<LogicalOperator>)
VALUE subquery: returns scalar value from first row of inner query.
MapProjection
Map projection: node { .prop1, .prop2, key: expr, .* }.
Fields
entries: Vec<MapProjectionEntry>Projection entries (property selectors, literal entries, all-properties).
Reduce
reduce() accumulator: reduce(acc = init, x IN list | expr).
Fields
initial: Box<LogicalExpression>Initial value for the accumulator.
list: Box<LogicalExpression>List to iterate over.
expression: Box<LogicalExpression>Body expression evaluated per iteration (references both accumulator and variable).
PatternComprehension
Pattern comprehension: [(pattern) WHERE pred | expr].
Executes the inner subplan, evaluates the projection for each row, and collects the results into a list.
Fields
subplan: Box<LogicalOperator>The subplan produced by translating the pattern (+optional WHERE).
projection: Box<LogicalExpression>The projection expression evaluated for each match.
Trait Implementations§
Source§impl Clone for LogicalExpression
impl Clone for LogicalExpression
Source§fn clone(&self) -> LogicalExpression
fn clone(&self) -> LogicalExpression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LogicalExpression
impl RefUnwindSafe for LogicalExpression
impl Send for LogicalExpression
impl Sync for LogicalExpression
impl Unpin for LogicalExpression
impl UnsafeUnpin for LogicalExpression
impl UnwindSafe for LogicalExpression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more