sqruff_lib_dialects/
lib.rs1use sqruff_lib_core::dialects::Dialect;
2use sqruff_lib_core::dialects::init::DialectKind;
3use sqruff_lib_core::value::Value;
4
5pub mod ansi;
6mod ansi_keywords;
7#[cfg(feature = "athena")]
8pub mod athena;
9#[cfg(feature = "athena")]
10mod athena_keywords;
11#[cfg(feature = "bigquery")]
12pub mod bigquery;
13#[cfg(feature = "bigquery")]
14mod bigquery_keywords;
15#[cfg(feature = "clickhouse")]
16pub mod clickhouse;
17#[cfg(feature = "clickhouse")]
18mod clickhouse_keywords;
19#[cfg(feature = "databricks")]
20pub mod databricks;
21#[cfg(feature = "databricks")]
22pub mod databricks_keywords;
23#[cfg(feature = "duckdb")]
24pub mod duckdb;
25#[cfg(feature = "hive")]
26pub mod hive;
27#[cfg(feature = "mysql")]
28pub mod mysql;
29#[cfg(feature = "postgres")]
30pub mod postgres;
31#[cfg(feature = "postgres")]
32mod postgres_keywords;
33#[cfg(feature = "redshift")]
34pub mod redshift;
35#[cfg(feature = "redshift")]
36mod redshift_keywords;
37#[cfg(feature = "snowflake")]
38pub mod snowflake;
39#[cfg(feature = "snowflake")]
40mod snowflake_keywords;
41#[cfg(feature = "sparksql")]
42pub mod sparksql;
43#[cfg(feature = "sparksql")]
44mod sparksql_keywords;
45#[cfg(feature = "sqlite")]
46pub mod sqlite;
47#[cfg(feature = "sqlite")]
48mod sqlite_keywords;
49#[cfg(feature = "trino")]
50pub mod trino;
51#[cfg(feature = "trino")]
52mod trino_keywords;
53#[cfg(feature = "tsql")]
54pub mod tsql;
55#[cfg(feature = "tsql")]
56mod tsql_keywords;
57
58pub fn kind_to_dialect(kind: &DialectKind, config: Option<&Value>) -> Option<Dialect> {
59 #[allow(unreachable_patterns)]
60 Some(match kind {
61 DialectKind::Ansi => ansi::dialect(config),
62 #[cfg(feature = "athena")]
63 DialectKind::Athena => athena::dialect(config),
64 #[cfg(feature = "bigquery")]
65 DialectKind::Bigquery => bigquery::dialect(config),
66 #[cfg(feature = "clickhouse")]
67 DialectKind::Clickhouse => clickhouse::dialect(config),
68 #[cfg(feature = "databricks")]
69 DialectKind::Databricks => databricks::dialect(config),
70 #[cfg(feature = "duckdb")]
71 DialectKind::Duckdb => duckdb::dialect(config),
72 #[cfg(feature = "mysql")]
73 DialectKind::Mysql => mysql::dialect(config),
74 #[cfg(feature = "postgres")]
75 DialectKind::Postgres => postgres::dialect(config),
76 #[cfg(feature = "redshift")]
77 DialectKind::Redshift => redshift::dialect(config),
78 #[cfg(feature = "snowflake")]
79 DialectKind::Snowflake => snowflake::dialect(config),
80 #[cfg(feature = "sparksql")]
81 DialectKind::Sparksql => sparksql::dialect(config),
82 #[cfg(feature = "sqlite")]
83 DialectKind::Sqlite => sqlite::dialect(config),
84 #[cfg(feature = "trino")]
85 DialectKind::Trino => trino::dialect(config),
86 #[cfg(feature = "tsql")]
87 DialectKind::Tsql => tsql::dialect(config),
88 _ => return None,
89 })
90}