Skip to main content

Query

Struct Query 

Source
pub struct Query {
Show 29 fields pub match_clauses: Vec<MatchClause>, pub where_clause: Option<WhereClause>, pub return_clause: Option<ReturnClause>, pub create_clause: Option<CreateClause>, pub order_by: Option<OrderByClause>, pub limit: Option<usize>, pub skip: Option<usize>, pub call_clause: Option<CallClause>, pub call_subquery: Option<Box<Query>>, pub delete_clause: Option<DeleteClause>, pub set_clauses: Vec<SetClause>, pub remove_clauses: Vec<RemoveClause>, pub with_clause: Option<WithClause>, pub create_vector_index_clause: Option<CreateVectorIndexClause>, pub create_index_clause: Option<CreateIndexClause>, pub drop_index_clause: Option<DropIndexClause>, pub create_constraint_clause: Option<CreateConstraintClause>, pub show_indexes: bool, pub show_constraints: bool, pub profile: bool, pub params: HashMap<String, PropertyValue>, pub foreach_clause: Option<ForeachClause>, pub unwind_clause: Option<UnwindClause>, pub merge_clause: Option<MergeClause>, pub union_queries: Vec<(Query, bool)>, pub explain: bool, pub with_split_index: Option<usize>, pub post_with_where_clause: Option<WhereClause>, pub extra_with_stages: Vec<(WithClause, Option<UnwindClause>, Vec<MatchClause>, Option<WhereClause>)>,
}
Expand description

The root AST node representing a complete Cypher query.

Every parsed Cypher statement produces exactly one Query. Its fields are grouped into four logical categories:

  1. Pattern matching: match_clauses, where_clause, post_with_where_clause – these define what to find in the graph (nodes, edges, paths, filters).

  2. Mutations: create_clause, delete_clause, set_clauses, remove_clauses, merge_clause, foreach_clause – these modify graph state. When any of these are present, the planner sets ExecutionPlan::is_write = true, which routes execution through MutQueryExecutor (requiring &mut GraphStore).

  3. Projection and ordering: return_clause, order_by, skip, limit, with_clause – these shape the output (column selection, sorting, pagination). WITH acts as a pipeline barrier: it materializes intermediate results and introduces a new scope, similar to a subquery in SQL.

  4. Schema and introspection: create_index_clause, drop_index_clause, create_constraint_clause, show_indexes, show_constraints, explain, profile – these are DDL/DML operations and diagnostic flags.

Fields§

§match_clauses: Vec<MatchClause>

MATCH clauses

§where_clause: Option<WhereClause>

WHERE clause (optional)

§return_clause: Option<ReturnClause>

RETURN clause (optional)

§create_clause: Option<CreateClause>

CREATE clause (optional)

§order_by: Option<OrderByClause>

ORDER BY clause (optional)

§limit: Option<usize>

LIMIT clause (optional)

§skip: Option<usize>

SKIP clause (optional)

§call_clause: Option<CallClause>

CALL clause (optional)

§call_subquery: Option<Box<Query>>

CALL subquery (optional)

§delete_clause: Option<DeleteClause>

DELETE clause (optional)

§set_clauses: Vec<SetClause>

SET clauses

§remove_clauses: Vec<RemoveClause>

REMOVE clauses

§with_clause: Option<WithClause>

WITH clause (optional)

§create_vector_index_clause: Option<CreateVectorIndexClause>

CREATE VECTOR INDEX clause (optional)

§create_index_clause: Option<CreateIndexClause>

CREATE INDEX clause (optional)

§drop_index_clause: Option<DropIndexClause>

DROP INDEX clause (optional)

§create_constraint_clause: Option<CreateConstraintClause>

CREATE CONSTRAINT clause (optional)

§show_indexes: bool

SHOW INDEXES flag

§show_constraints: bool

SHOW CONSTRAINTS flag

§profile: bool

PROFILE flag

§params: HashMap<String, PropertyValue>

Query parameters

§foreach_clause: Option<ForeachClause>

FOREACH clause (optional)

§unwind_clause: Option<UnwindClause>

UNWIND clause (optional)

§merge_clause: Option<MergeClause>

MERGE clause (optional)

§union_queries: Vec<(Query, bool)>

UNION queries (chained via UNION/UNION ALL)

§explain: bool

EXPLAIN clause (optional)

§with_split_index: Option<usize>

Index into match_clauses where WITH clause splits pre-WITH from post-WITH. match_clauses[..split] belong to pre-WITH, match_clauses[split..] to post-WITH.

§post_with_where_clause: Option<WhereClause>

Post-WITH WHERE clause (second WHERE after WITH … MATCH … WHERE …)

§extra_with_stages: Vec<(WithClause, Option<UnwindClause>, Vec<MatchClause>, Option<WhereClause>)>

Additional WITH stages (for multi-WITH queries like WITH … MATCH … WITH … RETURN) Each stage: (with_clause, unwind_clause, post_match_clauses, post_where_clause)

Implementations§

Source§

impl Query

Source

pub fn new() -> Self

Create a new empty query

Source

pub fn is_read_only(&self) -> bool

Check if this is a read-only query

Trait Implementations§

Source§

impl Clone for Query

Source§

fn clone(&self) -> Query

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Query

Source§

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

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

impl Default for Query

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Query

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 StructuralPartialEq for Query

Auto Trait Implementations§

§

impl Freeze for Query

§

impl RefUnwindSafe for Query

§

impl Send for Query

§

impl Sync for Query

§

impl Unpin for Query

§

impl UnsafeUnpin for Query

§

impl UnwindSafe for Query

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,