pub struct SetItem {
pub property: Option<PropertyAccess>,
pub variable: Option<SmallName>,
pub labels: Vec<LabelExpr>,
pub value: Option<Expr>,
pub merge: bool,
pub is_keyword: bool,
pub labels_function: Option<(Expr, LabelsFunctionOp)>,
}Expand description
A single item in a SET clause.
Fields§
§property: Option<PropertyAccess>§variable: Option<SmallName>§labels: Vec<LabelExpr>Each element is a LabelExpr::Label (static, SET n:A) or
LabelExpr::Dynamic (CIP-162, SET n:$(<expr>)/SET n IS $(<expr>))
atom – the parser never produces any other LabelExpr variant here
(no &/|/!/%/grouping). See RemoveItem::labels.
value: Option<Expr>§merge: bool§is_keyword: boolTrue if this label item used the CIP-126 IS keyword (SET n IS A)
rather than : (SET n:A). Only meaningful when labels is
non-empty. Used for the CIP-40/CIP-126 statement-level rule that
forbids mixing IS with a colon-conjunction (:A:B) anywhere in the
same statement.
labels_function: Option<(Expr, LabelsFunctionOp)>CIP-162 “Alternatives” section: SET labels(<expr>) = / += / -= <expr>. Per the proposal’s own text this was never shipped in Neo4j
(“we have decided to implement the rest first, and leave this as a
potential future extension”) – Relate implements it anyway as
the CIP’s stated target semantics. Some((target_expr, op)) when
this item is that form, with target_expr the node expression
inside labels(...) and value (above) holding the RHS list
expression.
Implementations§
Source§impl SetItem
impl SetItem
Sourcepub fn property_assignment(property: PropertyAccess, value: Expr) -> Self
pub fn property_assignment(property: PropertyAccess, value: Expr) -> Self
SET <property> = <value>.
Sourcepub fn variable_assignment(
variable: SmallName,
value: Expr,
merge: bool,
) -> Self
pub fn variable_assignment( variable: SmallName, value: Expr, merge: bool, ) -> Self
SET <variable> = <value>, or SET <variable> += <value> when
merge is set.
Sourcepub fn label_set(
variable: SmallName,
labels: Vec<LabelExpr>,
is_keyword: bool,
) -> Self
pub fn label_set( variable: SmallName, labels: Vec<LabelExpr>, is_keyword: bool, ) -> Self
SET <variable>:<labels> (or IS <labels> when is_keyword).
Sourcepub fn labels_function(target: Expr, op: LabelsFunctionOp, value: Expr) -> Self
pub fn labels_function(target: Expr, op: LabelsFunctionOp, value: Expr) -> Self
SET labels(<target>) <op> <value>.