forked from pressly/goose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialect.go
41 lines (36 loc) · 778 Bytes
/
dialect.go
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
package goose
import (
"fmt"
"github.com/pressly/goose/v3/internal/dialect"
)
func init() {
store, _ = dialect.NewStore(dialect.Postgres)
}
var store dialect.Store
// SetDialect sets the dialect to use for the goose package.
func SetDialect(s string) error {
var d dialect.Dialect
switch s {
case "postgres", "pgx":
d = dialect.Postgres
case "mysql":
d = dialect.Mysql
case "sqlite3", "sqlite":
d = dialect.Sqlite3
case "mssql", "azuresql", "sqlserver":
d = dialect.Sqlserver
case "redshift":
d = dialect.Redshift
case "tidb":
d = dialect.Tidb
case "clickhouse":
d = dialect.Clickhouse
case "vertica":
d = dialect.Vertica
default:
return fmt.Errorf("%q: unknown dialect", s)
}
var err error
store, err = dialect.NewStore(d)
return err
}