Skip to main content

QueryBuilder

Struct QueryBuilder 

Source
pub struct QueryBuilder { /* private fields */ }
Expand description

Fluent builder for constructing a QueryAst.

Start with QueryBuilder::nodes and chain filtering, traversal, and expansion steps before calling compile or compile_grouped.

Implementations§

Source§

impl QueryBuilder

Source

pub fn nodes(kind: impl Into<String>) -> Self

Create a builder that queries nodes of the given kind.

Add a vector similarity search step.

Add a full-text search step.

Source

pub fn traverse( self, direction: TraverseDirection, label: impl Into<String>, max_depth: usize, ) -> Self

Add a graph traversal step following edges of the given label.

Source

pub fn filter_logical_id_eq(self, logical_id: impl Into<String>) -> Self

Filter results to a single logical ID.

Source

pub fn filter_kind_eq(self, kind: impl Into<String>) -> Self

Filter results to nodes matching the given kind.

Source

pub fn filter_source_ref_eq(self, source_ref: impl Into<String>) -> Self

Filter results to nodes matching the given source_ref.

Source

pub fn filter_json_text_eq( self, path: impl Into<String>, value: impl Into<String>, ) -> Self

Filter results where a JSON property at path equals the given text value.

Source

pub fn filter_json_bool_eq(self, path: impl Into<String>, value: bool) -> Self

Filter results where a JSON property at path equals the given boolean value.

Source

pub fn filter_json_integer_gt(self, path: impl Into<String>, value: i64) -> Self

Filter results where a JSON integer at path is greater than value.

Source

pub fn filter_json_integer_gte( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON integer at path is greater than or equal to value.

Source

pub fn filter_json_integer_lt(self, path: impl Into<String>, value: i64) -> Self

Filter results where a JSON integer at path is less than value.

Source

pub fn filter_json_integer_lte( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON integer at path is less than or equal to value.

Source

pub fn filter_json_timestamp_gt( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON timestamp at path is after value (epoch seconds).

Source

pub fn filter_json_timestamp_gte( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON timestamp at path is at or after value.

Source

pub fn filter_json_timestamp_lt( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON timestamp at path is before value.

Source

pub fn filter_json_timestamp_lte( self, path: impl Into<String>, value: i64, ) -> Self

Filter results where a JSON timestamp at path is at or before value.

Source

pub fn expand( self, slot: impl Into<String>, direction: TraverseDirection, label: impl Into<String>, max_depth: usize, ) -> Self

Add an expansion slot that traverses edges of the given label for each root result.

Source

pub fn limit(self, limit: usize) -> Self

Set the maximum number of result rows.

Source

pub fn ast(&self) -> &QueryAst

Borrow the underlying QueryAst.

Source

pub fn into_ast(self) -> QueryAst

Consume the builder and return the underlying QueryAst.

Source

pub fn compile(&self) -> Result<CompiledQuery, CompileError>

Compile this builder’s AST into an executable CompiledQuery.

§Errors

Returns CompileError if the query violates structural constraints (e.g. too many traversal steps or too many bind parameters).

Source

pub fn compile_grouped(&self) -> Result<CompiledGroupedQuery, CompileError>

Compile this builder’s AST into an executable grouped query.

§Errors

Returns CompileError if the query violates grouped-query structural constraints such as duplicate slot names or excessive depth.

Trait Implementations§

Source§

impl Clone for QueryBuilder

Source§

fn clone(&self) -> QueryBuilder

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 QueryBuilder

Source§

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

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

impl PartialEq for QueryBuilder

Source§

fn eq(&self, other: &QueryBuilder) -> 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 Eq for QueryBuilder

Source§

impl StructuralPartialEq for QueryBuilder

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<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.