You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
450 B

  1. package initialize
  2. import (
  3. "github.com/flipped-aurora/gin-vue-admin/server/global"
  4. "gorm.io/gorm"
  5. )
  6. func DBList() {
  7. dbMap := make(map[string]*gorm.DB)
  8. for _, info := range global.GVA_CONFIG.DBList {
  9. if info.Disable {
  10. continue
  11. }
  12. switch info.Type {
  13. case "mysql":
  14. dbMap[info.Dbname] = GormMysqlByConfig(info)
  15. case "pgsql":
  16. dbMap[info.Dbname] = GormPgSqlByConfig(info)
  17. default:
  18. continue
  19. }
  20. }
  21. global.GVA_DBList = dbMap
  22. }