Skip to main content

qail_core/transpiler/
dialect.rs

1use crate::transpiler::sql::postgres::PostgresGenerator;
2use crate::transpiler::sql::sqlite::SqliteGenerator;
3use crate::transpiler::traits::SqlGenerator;
4
5/// SQL dialect selection for transpilation.
6#[derive(Debug, Clone, Copy, PartialEq, Default)]
7pub enum Dialect {
8    /// PostgreSQL dialect (default).
9    #[default]
10    Postgres,
11    /// SQLite dialect compatibility surface.
12    ///
13    /// PostgreSQL is the supported SQL runtime; this variant remains so 1.x
14    /// consumers that selected SQLite still compile.
15    SQLite,
16}
17
18impl Dialect {
19    /// Create the dialect-specific SQL generator.
20    pub fn generator(&self) -> Box<dyn SqlGenerator> {
21        match self {
22            Dialect::Postgres => Box::new(PostgresGenerator),
23            Dialect::SQLite => Box::new(SqliteGenerator),
24        }
25    }
26}