Skip to main content

alopex_sql/ast/
mod.rs

1pub mod ddl;
2pub mod dml;
3pub mod expr;
4pub mod span;
5
6pub use ddl::*;
7pub use dml::*;
8pub use expr::*;
9use serde::{Deserialize, Serialize};
10pub use span::{Location, Span, Spanned};
11
12/// Top-level SQL statement wrapper with span information.
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct Statement {
15    pub kind: StatementKind,
16    pub span: Span,
17}
18
19impl Spanned for Statement {
20    fn span(&self) -> Span {
21        self.span
22    }
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(tag = "variant")]
27#[allow(clippy::large_enum_variant)]
28pub enum StatementKind {
29    // DDL
30    CreateTable(CreateTable),
31    DropTable(DropTable),
32    CreateIndex(CreateIndex),
33    DropIndex(DropIndex),
34
35    // DML
36    Select(Select),
37    Insert(Insert),
38    Update(Update),
39    Delete(Delete),
40}