fixed driver initialisation for mssql.

pull/173/head
Aleksei Maslov 2019-05-24 14:44:43 +08:00
parent 799fcfb84b
commit a8f409041d
1 changed files with 3 additions and 1 deletions

4
db.go
View File

@ -13,6 +13,8 @@ func OpenDBWithDriver(driver string, dbstring string) (*sql.DB, error) {
}
switch driver {
case "mssql":
driver = "sqlserver"
case "redshift":
driver = "postgres"
case "tidb":
@ -20,7 +22,7 @@ func OpenDBWithDriver(driver string, dbstring string) (*sql.DB, error) {
}
switch driver {
case "postgres", "sqlite3", "mysql", "mssql":
case "postgres", "sqlite3", "mysql", "sqlserver":
return sql.Open(driver, dbstring)
default:
return nil, fmt.Errorf("unsupported driver %s", driver)