mentedb_query/mql.rs
1//! Public MQL entry point: parse an MQL string into a `QueryPlan`.
2
3use mentedb_core::error::MenteResult;
4
5use crate::lexer;
6use crate::parser::Parser;
7use crate::planner::{self, QueryPlan};
8
9/// The MQL query interface.
10///
11/// Combines lexing, parsing, and planning into a single call.
12#[derive(Debug, Default)]
13pub struct Mql;
14
15impl Mql {
16 /// Parse an MQL query string and produce an execution plan.
17 pub fn parse(input: &str) -> MenteResult<QueryPlan> {
18 let tokens = lexer::tokenize(input)?;
19 let statement = Parser::parse(&tokens)?;
20 planner::plan(&statement)
21 }
22}