sqruff_lib_dialects/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use sqruff_lib_core::dialects::base::Dialect;
use sqruff_lib_core::dialects::init::DialectKind;

pub mod ansi;
mod ansi_keywords;
#[cfg(feature = "athena")]
pub mod athena;
#[cfg(feature = "athena")]
mod athena_keywords;
#[cfg(feature = "bigquery")]
pub mod bigquery;
#[cfg(feature = "bigquery")]
mod bigquery_keywords;
#[cfg(feature = "clickhouse")]
pub mod clickhouse;
#[cfg(feature = "clickhouse")]
mod clickhouse_keywords;
#[cfg(feature = "databricks")]
pub mod databricks;
#[cfg(feature = "databricks")]
pub mod databricks_keywords;
#[cfg(feature = "duckdb")]
pub mod duckdb;
#[cfg(feature = "hive")]
pub mod hive;
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "postgres")]
mod postgres_keywords;
#[cfg(feature = "redshift")]
pub mod redshift;
#[cfg(feature = "redshift")]
mod redshift_keywords;
#[cfg(feature = "snowflake")]
pub mod snowflake;
#[cfg(feature = "snowflake")]
mod snowflake_keywords;
#[cfg(feature = "sparksql")]
pub mod sparksql;
#[cfg(feature = "sparksql")]
mod sparksql_keywords;
#[cfg(feature = "sqlite")]
pub mod sqlite;
#[cfg(feature = "sqlite")]
mod sqlite_keywords;
#[cfg(feature = "trino")]
pub mod trino;
#[cfg(feature = "trino")]
mod trino_keywords;

pub fn kind_to_dialect(kind: &DialectKind) -> Option<Dialect> {
    #[allow(unreachable_patterns)]
    Some(match kind {
        DialectKind::Ansi => ansi::dialect(),
        #[cfg(feature = "athena")]
        DialectKind::Athena => athena::dialect(),
        #[cfg(feature = "bigquery")]
        DialectKind::Bigquery => bigquery::dialect(),
        #[cfg(feature = "clickhouse")]
        DialectKind::Clickhouse => clickhouse::dialect(),
        #[cfg(feature = "databricks")]
        DialectKind::Databricks => databricks::dialect(),
        #[cfg(feature = "duckdb")]
        DialectKind::Duckdb => duckdb::dialect(),
        #[cfg(feature = "postgres")]
        DialectKind::Postgres => postgres::dialect(),
        #[cfg(feature = "redshift")]
        DialectKind::Redshift => redshift::dialect(),
        #[cfg(feature = "snowflake")]
        DialectKind::Snowflake => snowflake::dialect(),
        #[cfg(feature = "sparksql")]
        DialectKind::Sparksql => sparksql::dialect(),
        #[cfg(feature = "sqlite")]
        DialectKind::Sqlite => sqlite::dialect(),
        #[cfg(feature = "trino")]
        DialectKind::Trino => trino::dialect(),
        _ => return None,
    })
}