2019-11-10 08:42:49 +00:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
2021-05-21 20:52:03 +00:00
|
|
|
"../../../hotime"
|
|
|
|
"../mysql"
|
|
|
|
"../sqlite"
|
2019-11-10 08:42:49 +00:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func SetDB(appIns *hotime.Application) {
|
2019-11-10 08:49:05 +00:00
|
|
|
if appIns.Config.GetString("dbType") == "sqlite" || strings.Index(appIns.Config.GetString("dbName"), ".db") == len(appIns.Config.GetString("dbName"))-3 {
|
2019-11-10 08:51:27 +00:00
|
|
|
appIns.Config["dbType"] = "sqlite"
|
2019-11-10 08:42:49 +00:00
|
|
|
sqlite.SetDB(appIns)
|
|
|
|
} else {
|
2019-11-10 08:51:27 +00:00
|
|
|
appIns.Config["dbType"] = "mysql"
|
2019-11-10 08:42:49 +00:00
|
|
|
mysql.SetDB(appIns)
|
|
|
|
}
|
|
|
|
}
|