Skip to main content

QueryRunner

Trait QueryRunner 

Source
pub trait QueryRunner:
    Send
    + Sync
    + 'static {
    // Required methods
    fn execute(
        &self,
        query: &str,
        options: Option<ExecuteOptions>,
    ) -> Result<QueryResult, LoraError>;
    fn explain(
        &self,
        query: &str,
        params: Option<BTreeMap<String, LoraValue>>,
    ) -> Result<QueryPlan, LoraError>;
    fn profile(
        &self,
        query: &str,
        params: Option<BTreeMap<String, LoraValue>>,
    ) -> Result<QueryProfile, LoraError>;
}
Expand description

Minimal abstraction any transport can depend on to run Lora queries.

execute runs a query and returns rows. explain and profile are deliberately separate methods: explain never invokes the executor (so it can be called on mutating queries without side effects) and profile runs the executor and reports runtime metrics. Transports MUST NOT route plan / profile requests through execute — exposing the plan-only and profile-with-metrics behaviours as separate methods is part of the public contract.

Required Methods§

Source

fn execute( &self, query: &str, options: Option<ExecuteOptions>, ) -> Result<QueryResult, LoraError>

Source

fn explain( &self, query: &str, params: Option<BTreeMap<String, LoraValue>>, ) -> Result<QueryPlan, LoraError>

Compile a query and return its plan without executing it.

Source

fn profile( &self, query: &str, params: Option<BTreeMap<String, LoraValue>>, ) -> Result<QueryProfile, LoraError>

Execute a query and return its plan plus runtime metrics. Mutating queries are persisted exactly as in execute.

Implementors§

Source§

impl<S> QueryRunner for Database<S>
where S: GraphStorage + GraphStorageMut + Any + Clone + Send + Sync + 'static,