增加跨域配置,以及增加配置说明
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"code.hoteas.com/hoteas/hotime"
|
||||
"code.hoteas.com/hoteas/hotime/tools/mysql"
|
||||
"code.hoteas.com/hoteas/hotime/tools/sqlite"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SetDB(appIns *hotime.Application) {
|
||||
if appIns.Config.GetString("dbType") == "sqlite" || strings.Index(appIns.Config.GetString("dbName"), ".db") == len(appIns.Config.GetString("dbName"))-3 {
|
||||
appIns.Config["dbType"] = "sqlite"
|
||||
sqlite.SetDB(appIns)
|
||||
} else {
|
||||
appIns.Config["dbType"] = "mysql"
|
||||
mysql.SetDB(appIns)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user