-
-
Notifications
You must be signed in to change notification settings - Fork 526
Expand file tree
/
Copy pathdialects.ts
More file actions
25 lines (23 loc) · 729 Bytes
/
dialects.ts
File metadata and controls
25 lines (23 loc) · 729 Bytes
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
import { mssqlOptions } from "./mssql";
import { mysqlOptions } from "./mysql";
import { postgresOptions } from "./postgres";
import { sqliteOptions } from "./sqlite";
import { DialectOptions } from "./dialect-options";
import { Dialect } from "sequelize";
const dialects: { [name in Dialect]: DialectOptions | null } = {
db2: null,
oracle: null,
snowflake: null,
mssql: mssqlOptions,
mysql: mysqlOptions,
mariadb: mysqlOptions,
postgres: postgresOptions,
sqlite: sqliteOptions
};
export function getDialect(dialectName: Dialect) : DialectOptions {
const result = dialects[dialectName];
if(!result) {
throw new Error(`Dialect not available for ${dialectName}`);
}
return result as DialectOptions;
}