alopex-sql 0.6.0

SQL parser components for the Alopex DB dialect
pub mod ddl;
pub mod dml;
pub mod expr;
pub mod span;

pub use ddl::*;
pub use dml::*;
pub use expr::*;
use serde::{Deserialize, Serialize};
pub use span::{Location, Span, Spanned};

/// Top-level SQL statement wrapper with span information.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Statement {
    pub kind: StatementKind,
    pub span: Span,
}

impl Spanned for Statement {
    fn span(&self) -> Span {
        self.span
    }
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "variant")]
#[allow(clippy::large_enum_variant)]
pub enum StatementKind {
    // DDL
    CreateTable(CreateTable),
    DropTable(DropTable),
    CreateIndex(CreateIndex),
    DropIndex(DropIndex),

    // DML
    Select(Select),
    Insert(Insert),
    Update(Update),
    Delete(Delete),
}