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