feat: issues #809
This commit is contained in:
24
server/initialize/db_list.go
Normal file
24
server/initialize/db_list.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func DBList() {
|
||||
dbMap := make(map[string]*gorm.DB)
|
||||
for _, info := range global.GVA_CONFIG.DBList {
|
||||
if info.Disable {
|
||||
continue
|
||||
}
|
||||
switch info.Type {
|
||||
case "mysql":
|
||||
dbMap[info.Dbname] = GormMysqlByConfig(info)
|
||||
case "pgsql":
|
||||
dbMap[info.Dbname] = GormPgSqlByConfig(info)
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
global.GVA_DBList = dbMap
|
||||
}
|
Reference in New Issue
Block a user