自动设置数据库
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"code.hoteas.com/hoteas/hotime"
|
||||
"code.hoteas.com/hoteas/hotime/dri/mysql"
|
||||
"code.hoteas.com/hoteas/hotime/dri/sqlite"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SetDB(appIns *hotime.Application) {
|
||||
if appIns.Config.GetString("dbType") == "sqlite" || strings.Contains(appIns.Config.GetString("dbName"), ".db") {
|
||||
sqlite.SetDB(appIns)
|
||||
} else {
|
||||
mysql.SetDB(appIns)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user