Skip to content

Commit 87926fc

Browse files
committed
feat(nodedb-sql): add typed DDL AST module
Introduce `nodedb_sql::ddl_ast` — a typed representation of every NodeDB DDL statement as `NodedbStatement` enum variants, with a whitespace-token parser that converts raw SQL into the typed form. The AST gives DDL dispatch a compiler-checked match instead of string-prefix branching, so adding a new DDL command forces handling in every affected site at compile time rather than at runtime.
1 parent 6da002f commit 87926fc

4 files changed

Lines changed: 900 additions & 0 deletions

File tree

nodedb-sql/src/ddl_ast/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Typed AST for NodeDB-specific DDL statements.
2+
//!
3+
//! Every DDL command the system supports is represented as a variant
4+
//! of [`NodedbStatement`]. The DDL router matches on this enum
5+
//! instead of string prefixes, so the compiler catches missing
6+
//! handlers when a new DDL is added.
7+
//!
8+
//! The parser ([`parse`]) converts raw SQL into a `NodedbStatement`
9+
//! using whitespace-split token matching — the same technique the
10+
//! old string-prefix router used, but producing a typed output.
11+
12+
pub mod parse;
13+
pub mod statement;
14+
15+
pub use parse::parse;
16+
pub use statement::NodedbStatement;

0 commit comments

Comments
 (0)