use super::{MySQLCompiler, PostgresCompiler, SQLiteCompiler, SqlCompiler};
use crate::schema::SqlDialect;
#[derive(Debug, Clone, Copy, Default)]
pub struct CompilerRegistry;
impl CompilerRegistry {
pub fn get(dialect: SqlDialect) -> Box<dyn SqlCompiler> {
get_compiler(dialect)
}
}
pub fn get_compiler(dialect: SqlDialect) -> Box<dyn SqlCompiler> {
match dialect {
SqlDialect::Postgres => Box::new(PostgresCompiler),
SqlDialect::Sqlite => Box::new(SQLiteCompiler),
SqlDialect::MySql => Box::new(MySQLCompiler),
}
}