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>;
// Provided method
fn execute_with_params(
&self,
query: &str,
options: Option<ExecuteOptions>,
params: BTreeMap<String, LoraValue>,
) -> Result<QueryResult, 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§
fn execute( &self, query: &str, options: Option<ExecuteOptions>, ) -> Result<QueryResult, LoraError>
Provided Methods§
Sourcefn execute_with_params(
&self,
query: &str,
options: Option<ExecuteOptions>,
params: BTreeMap<String, LoraValue>,
) -> Result<QueryResult, LoraError>
fn execute_with_params( &self, query: &str, options: Option<ExecuteOptions>, params: BTreeMap<String, LoraValue>, ) -> Result<QueryResult, LoraError>
Execute a query with bound parameters. Implementors that cannot bind parameters should reject non-empty maps instead of silently ignoring them.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".