Skip to main content

WriteOp

Enum WriteOp 

Source
#[non_exhaustive]
pub enum WriteOp { CreateNode { labels: Vec<SmolStr>, props: Expr, bind: Option<VarId>, }, CreateRel { from: VarId, to: VarId, rel_type: SmolStr, props: Expr, bind: Option<VarId>, }, MergeNode { labels: Vec<SmolStr>, props: Expr, on_create: Vec<WriteOp>, on_match: Vec<WriteOp>, bind: Option<VarId>, }, MergeRel { from: VarId, to: VarId, rel_type: SmolStr, props: Expr, on_create: Vec<WriteOp>, on_match: Vec<WriteOp>, bind: Option<VarId>, }, SetProperty { target: VarId, prop: SmolStr, value: Expr, }, SetLabels { target: VarId, labels: Vec<SmolStr>, }, RemoveProperty { target: VarId, prop: SmolStr, }, RemoveLabels { target: VarId, labels: Vec<SmolStr>, }, Delete { targets: Vec<Expr>, detach: bool, }, }
Expand description

Logical write-plan operator. Spec §12.1.

Write operators are applied sequentially after the read phase produces a row. Consumers own the sequencing and transactional semantics. This crate describes what to write, not how.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CreateNode

Create a new node with the given labels and properties.

props is evaluated to a map expression at write time. bind, if present, makes the new node available under that variable for subsequent operators. Spec §12.1 W1.

Fields

§labels: Vec<SmolStr>

Labels to apply to the new node.

§props: Expr

Map expression supplying the initial properties.

§bind: Option<VarId>

Optional variable binding for the created node.

§

CreateRel

Create a new relationship between two already-bound nodes.

Spec §12.1 W2.

Fields

§from: VarId

Variable holding the start node.

§to: VarId

Variable holding the end node.

§rel_type: SmolStr

Relationship type (exactly one, required by Cypher syntax).

§props: Expr

Map expression supplying the initial properties.

§bind: Option<VarId>

Optional variable binding for the created relationship.

§

MergeNode

Merge a node — create if absent, match if present.

on_create / on_match are applied depending on whether the node was newly created or already existed. Spec §12.1 W3.

Fields

§labels: Vec<SmolStr>

Labels that uniquely identify the node.

§props: Expr

Property predicate / initial values.

§on_create: Vec<WriteOp>

Write operations to apply when a new node is created.

§on_match: Vec<WriteOp>

Write operations to apply when an existing node is found.

§bind: Option<VarId>

Optional variable binding for the merged node.

§

MergeRel

Merge a relationship — create if absent, match if present.

Analogous to WriteOp::MergeNode but for relationships. Spec §12.1 W4.

Fields

§from: VarId

Variable holding the start node.

§to: VarId

Variable holding the end node.

§rel_type: SmolStr

Relationship type.

§props: Expr

Property predicate / initial values.

§on_create: Vec<WriteOp>

Write operations to apply when a new relationship is created.

§on_match: Vec<WriteOp>

Write operations to apply when an existing relationship is found.

§bind: Option<VarId>

Optional variable binding for the merged relationship.

§

SetProperty

Set a single property on a node or relationship. Spec §12.1 W5.

Fields

§target: VarId

Variable holding the target entity.

§prop: SmolStr

Property key.

§value: Expr

New value expression.

§

SetLabels

Add or replace the label set on a node. Spec §12.1 W6.

Fields

§target: VarId

Variable holding the target node.

§labels: Vec<SmolStr>

Labels to add.

§

RemoveProperty

Remove a single property from a node or relationship. Spec §12.1 W7.

Fields

§target: VarId

Variable holding the target entity.

§prop: SmolStr

Property key to remove.

§

RemoveLabels

Remove labels from a node. Spec §12.1 W8.

Fields

§target: VarId

Variable holding the target node.

§labels: Vec<SmolStr>

Labels to remove.

§

Delete

Delete nodes or relationships. Spec §12.1 W9.

When detach is true this is DETACH DELETE, which removes all incident relationships before deleting the node.

Fields

§targets: Vec<Expr>

Expressions evaluating to the entities to delete.

§detach: bool

true for DETACH DELETE.

Trait Implementations§

Source§

impl Clone for WriteOp

Source§

fn clone(&self) -> WriteOp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriteOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for WriteOp

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for WriteOp

Source§

fn eq(&self, other: &WriteOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for WriteOp

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for WriteOp

Source§

impl StructuralPartialEq for WriteOp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,