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
impl QueryBuilder
Sourcepub fn nodes(kind: impl Into<String>) -> Self
pub fn nodes(kind: impl Into<String>) -> Self
Create a builder that queries nodes of the given kind.
Sourcepub fn vector_search(self, query: impl Into<String>, limit: usize) -> Self
pub fn vector_search(self, query: impl Into<String>, limit: usize) -> Self
Add a vector similarity search step.
Sourcepub fn text_search(self, query: impl Into<String>, limit: usize) -> Self
pub fn text_search(self, query: impl Into<String>, limit: usize) -> Self
Add a full-text search step.
Sourcepub fn traverse(
self,
direction: TraverseDirection,
label: impl Into<String>,
max_depth: usize,
) -> Self
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.
Sourcepub fn filter_logical_id_eq(self, logical_id: impl Into<String>) -> Self
pub fn filter_logical_id_eq(self, logical_id: impl Into<String>) -> Self
Filter results to a single logical ID.
Sourcepub fn filter_kind_eq(self, kind: impl Into<String>) -> Self
pub fn filter_kind_eq(self, kind: impl Into<String>) -> Self
Filter results to nodes matching the given kind.
Sourcepub fn filter_source_ref_eq(self, source_ref: impl Into<String>) -> Self
pub fn filter_source_ref_eq(self, source_ref: impl Into<String>) -> Self
Filter results to nodes matching the given source_ref.
Sourcepub fn filter_json_text_eq(
self,
path: impl Into<String>,
value: impl Into<String>,
) -> Self
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.
Sourcepub fn filter_json_bool_eq(self, path: impl Into<String>, value: bool) -> Self
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.
Sourcepub fn filter_json_integer_gt(self, path: impl Into<String>, value: i64) -> Self
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.
Sourcepub fn filter_json_integer_gte(
self,
path: impl Into<String>,
value: i64,
) -> Self
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.
Sourcepub fn filter_json_integer_lt(self, path: impl Into<String>, value: i64) -> Self
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.
Sourcepub fn filter_json_integer_lte(
self,
path: impl Into<String>,
value: i64,
) -> Self
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.
Sourcepub fn filter_json_timestamp_gt(
self,
path: impl Into<String>,
value: i64,
) -> Self
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).
Sourcepub fn filter_json_timestamp_gte(
self,
path: impl Into<String>,
value: i64,
) -> Self
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.
Sourcepub fn filter_json_timestamp_lt(
self,
path: impl Into<String>,
value: i64,
) -> Self
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.
Sourcepub fn filter_json_timestamp_lte(
self,
path: impl Into<String>,
value: i64,
) -> Self
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.
Sourcepub fn expand(
self,
slot: impl Into<String>,
direction: TraverseDirection,
label: impl Into<String>,
max_depth: usize,
) -> Self
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.
Sourcepub fn compile(&self) -> Result<CompiledQuery, CompileError>
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).
Sourcepub fn compile_grouped(&self) -> Result<CompiledGroupedQuery, CompileError>
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
impl Clone for QueryBuilder
Source§fn clone(&self) -> QueryBuilder
fn clone(&self) -> QueryBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more