Skip to main content

linkrs_server/graph_service/
context.rs

1use std::collections::HashMap;
2use std::sync::Arc;
3
4use crate::query::parser::ast::stmt::Ast;
5
6/// Common execution context shared by all query/command execution paths.
7///
8/// Groups the per-statement parameters that flow through the execution
9/// pipeline, eliminating repetitive argument lists and reducing the risk of
10/// parameter-ordering mistakes.
11pub struct QueryExecutionContext<'a> {
12    /// The raw statement text.
13    pub stmt: &'a str,
14    /// Pre-parsed AST (available for command statements from the
15    /// classification pass; `None` for regular statements).
16    pub parsed_ast: Option<Arc<Ast>>,
17    /// Target space id (0 when no space is selected).
18    pub space_id: i64,
19    /// Client-supplied query parameters (`@name` references).
20    pub parameters: Option<HashMap<String, linkrs_core::Value>>,
21    /// Client-supplied session variables (`$name` references).
22    pub session_variables: Option<HashMap<String, linkrs_core::Value>>,
23}