feat(database): add mysql support (#39)

This commit is contained in:
tardc
2021-12-23 01:34:53 +08:00
committed by GitHub
parent 8e96962791
commit 9d7a5b4598
3 changed files with 27 additions and 1 deletions
+3
View File
@@ -10,12 +10,15 @@ var (
type DriverType = string
const Sqlite = "sqlite"
const Mysql = "mysql"
func InitDB(driver DriverType, dsn string) (err error) {
Driver = driver
switch driver {
case Sqlite:
DB, err = NewSqlite3(dsn)
case Mysql:
DB, err = NewMysql(dsn)
}
return err
}