pub struct QueryEngine { /* private fields */ }Expand description
Query engine - high-level interface for executing queries
Includes an LRU AST cache that eliminates repeated parsing overhead for identical queries. The cache is keyed by whitespace-normalized query strings and evicts least-recently-used entries when full.
Implementations§
Source§impl QueryEngine
impl QueryEngine
Sourcepub fn new() -> QueryEngine
pub fn new() -> QueryEngine
Create a new query engine with the default cache capacity (1024 entries)
Sourcepub fn with_capacity(capacity: usize) -> QueryEngine
pub fn with_capacity(capacity: usize) -> QueryEngine
Create a new query engine with a specific cache capacity
Sourcepub fn cache_stats(&self) -> &CacheStats
pub fn cache_stats(&self) -> &CacheStats
Return a reference to the cache statistics (hits/misses).
Sourcepub fn strip_line_comments(input: &str) -> String
pub fn strip_line_comments(input: &str) -> String
Split a query string on semicolons, respecting quoted strings.
Returns individual statement strings (trimmed, non-empty).
Strip // ... line comments (not inside strings).
Returns a new string with comments removed.
pub fn split_statements(input: &str) -> Vec<&str>
Sourcepub fn execute(
&self,
query_str: &str,
store: &GraphStore,
) -> Result<RecordBatch, Box<dyn Error>>
pub fn execute( &self, query_str: &str, store: &GraphStore, ) -> Result<RecordBatch, Box<dyn Error>>
Parse and execute a read-only Cypher query (MATCH, RETURN, etc.) Supports multiple semicolon-separated statements.
Sourcepub fn execute_with_params(
&self,
query_str: &str,
store: &GraphStore,
params: &HashMap<String, PropertyValue>,
) -> Result<RecordBatch, Box<dyn Error>>
pub fn execute_with_params( &self, query_str: &str, store: &GraphStore, params: &HashMap<String, PropertyValue>, ) -> Result<RecordBatch, Box<dyn Error>>
Execute a read-only query with parameters
Sourcepub fn execute_mut(
&self,
query_str: &str,
store: &mut GraphStore,
tenant_id: &str,
) -> Result<RecordBatch, Box<dyn Error>>
pub fn execute_mut( &self, query_str: &str, store: &mut GraphStore, tenant_id: &str, ) -> Result<RecordBatch, Box<dyn Error>>
Parse and execute a write Cypher query (CREATE, DELETE, SET, etc.) Supports multiple semicolon-separated statements. Each statement sees the effects of previous statements (shared store). Also rewrites multi-CREATE queries to use WITH for variable sharing.
Sourcepub fn execute_mut_with_params(
&self,
query_str: &str,
store: &mut GraphStore,
tenant_id: &str,
params: &HashMap<String, PropertyValue>,
) -> Result<RecordBatch, Box<dyn Error>>
pub fn execute_mut_with_params( &self, query_str: &str, store: &mut GraphStore, tenant_id: &str, params: &HashMap<String, PropertyValue>, ) -> Result<RecordBatch, Box<dyn Error>>
Execute a write query with parameters
Trait Implementations§
Source§impl Default for QueryEngine
impl Default for QueryEngine
Source§fn default() -> QueryEngine
fn default() -> QueryEngine
Auto Trait Implementations§
impl !Freeze for QueryEngine
impl RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl Sync for QueryEngine
impl Unpin for QueryEngine
impl UnsafeUnpin for QueryEngine
impl UnwindSafe for QueryEngine
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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