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>) -> QueryBuilder
pub fn nodes(kind: impl Into<String>) -> QueryBuilder
Create a builder that queries nodes of the given kind.
Sourcepub fn vector_search(
self,
query: impl Into<String>,
limit: usize,
) -> QueryBuilder
pub fn vector_search( self, query: impl Into<String>, limit: usize, ) -> QueryBuilder
Add a vector similarity search step.
Sourcepub fn text_search(self, query: impl Into<String>, limit: usize) -> QueryBuilder
pub fn text_search(self, query: impl Into<String>, limit: usize) -> QueryBuilder
Add a full-text search step.
The input is parsed into FathomDB’s safe supported subset: literal
terms, quoted phrases, uppercase OR, uppercase NOT, and implicit
AND by adjacency. Unsupported syntax remains literal rather than being
passed through as raw FTS5 control syntax.
Sourcepub fn traverse(
self,
direction: TraverseDirection,
label: impl Into<String>,
max_depth: usize,
) -> QueryBuilder
pub fn traverse( self, direction: TraverseDirection, label: impl Into<String>, max_depth: usize, ) -> QueryBuilder
Add a graph traversal step following edges of the given label.
Sourcepub fn filter_logical_id_eq(self, logical_id: impl Into<String>) -> QueryBuilder
pub fn filter_logical_id_eq(self, logical_id: impl Into<String>) -> QueryBuilder
Filter results to a single logical ID.
Sourcepub fn filter_kind_eq(self, kind: impl Into<String>) -> QueryBuilder
pub fn filter_kind_eq(self, kind: impl Into<String>) -> QueryBuilder
Filter results to nodes matching the given kind.
Sourcepub fn filter_source_ref_eq(self, source_ref: impl Into<String>) -> QueryBuilder
pub fn filter_source_ref_eq(self, source_ref: impl Into<String>) -> QueryBuilder
Filter results to nodes matching the given source_ref.
Sourcepub fn filter_content_ref_not_null(self) -> QueryBuilder
pub fn filter_content_ref_not_null(self) -> QueryBuilder
Filter results to nodes where content_ref is not NULL.
Sourcepub fn filter_content_ref_eq(
self,
content_ref: impl Into<String>,
) -> QueryBuilder
pub fn filter_content_ref_eq( self, content_ref: impl Into<String>, ) -> QueryBuilder
Filter results to nodes matching the given content_ref URI.
Sourcepub fn filter_json_text_eq(
self,
path: impl Into<String>,
value: impl Into<String>,
) -> QueryBuilder
pub fn filter_json_text_eq( self, path: impl Into<String>, value: impl Into<String>, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_bool_eq( self, path: impl Into<String>, value: bool, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_integer_gt( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_integer_gte( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_integer_lt( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_integer_lte( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_timestamp_gt( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_timestamp_gte( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
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,
) -> QueryBuilder
pub fn filter_json_timestamp_lt( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Filter results where a JSON timestamp at path is before value.
Sourcepub fn filter_json_timestamp_lte(
self,
path: impl Into<String>,
value: i64,
) -> QueryBuilder
pub fn filter_json_timestamp_lte( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Filter results where a JSON timestamp at path is at or before value.
Sourcepub fn filter_json_fused_text_eq_unchecked(
self,
path: impl Into<String>,
value: impl Into<String>,
) -> QueryBuilder
pub fn filter_json_fused_text_eq_unchecked( self, path: impl Into<String>, value: impl Into<String>, ) -> QueryBuilder
Append a fused JSON text-equality predicate without validating whether the caller has a property-FTS schema for the kind.
Callers must have already validated the fusion gate; the
tethered crate::QueryBuilder has no engine handle to consult
a schema. Mis-use — calling this without prior schema
validation — produces SQL that pushes a json_extract predicate
into the search CTE’s inner WHERE clause. That is valid SQL but
defeats the “developer opt-in” contract.
Sourcepub fn filter_json_fused_timestamp_gt_unchecked(
self,
path: impl Into<String>,
value: i64,
) -> QueryBuilder
pub fn filter_json_fused_timestamp_gt_unchecked( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Append a fused JSON timestamp-greater-than predicate without
validating the fusion gate. See
Self::filter_json_fused_text_eq_unchecked for the contract.
Sourcepub fn filter_json_fused_timestamp_gte_unchecked(
self,
path: impl Into<String>,
value: i64,
) -> QueryBuilder
pub fn filter_json_fused_timestamp_gte_unchecked( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Append a fused JSON timestamp-greater-or-equal predicate without
validating the fusion gate. See
Self::filter_json_fused_text_eq_unchecked for the contract.
Sourcepub fn filter_json_fused_timestamp_lt_unchecked(
self,
path: impl Into<String>,
value: i64,
) -> QueryBuilder
pub fn filter_json_fused_timestamp_lt_unchecked( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Append a fused JSON timestamp-less-than predicate without
validating the fusion gate. See
Self::filter_json_fused_text_eq_unchecked for the contract.
Sourcepub fn filter_json_fused_timestamp_lte_unchecked(
self,
path: impl Into<String>,
value: i64,
) -> QueryBuilder
pub fn filter_json_fused_timestamp_lte_unchecked( self, path: impl Into<String>, value: i64, ) -> QueryBuilder
Append a fused JSON timestamp-less-or-equal predicate without
validating the fusion gate. See
Self::filter_json_fused_text_eq_unchecked for the contract.
Sourcepub fn expand(
self,
slot: impl Into<String>,
direction: TraverseDirection,
label: impl Into<String>,
max_depth: usize,
filter: Option<Predicate>,
) -> QueryBuilder
pub fn expand( self, slot: impl Into<String>, direction: TraverseDirection, label: impl Into<String>, max_depth: usize, filter: Option<Predicate>, ) -> QueryBuilder
Add an expansion slot that traverses edges of the given label for each root result.
Pass filter: None to preserve the existing behavior. filter: Some(_) is
accepted by the AST but the compilation is not yet implemented (Pack 3).
Sourcepub fn limit(self, limit: usize) -> QueryBuilder
pub fn limit(self, limit: usize) -> QueryBuilder
Set the maximum number of result rows.
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 moreSource§impl Debug for QueryBuilder
impl Debug for QueryBuilder
Source§impl PartialEq for QueryBuilder
impl PartialEq for QueryBuilder
impl Eq for QueryBuilder
impl StructuralPartialEq for QueryBuilder
Auto Trait Implementations§
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnsafeUnpin for QueryBuilder
impl UnwindSafe for QueryBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.