数据库连接初始化优化
权限部分修改
This commit is contained in:
1 parent
4979fd659f
commit
deeb82048b
37 files changed
+726
-721
No files matched your search
@@ -1,22 +1,21 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/casbin/casbin/v2"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Conf interface {
|
||||
//多db设置,⚠️SetDbs不允许并发,可以根据自己的业务,例如app分库、host分库
|
||||
SetDbs(key string, db *DBConfig)
|
||||
GetDbs() map[string]*DBConfig
|
||||
GetDbByKey(key string) *DBConfig
|
||||
GetSaas() bool
|
||||
SetSaas(bool)
|
||||
SetDb(key string, db *gorm.DB)
|
||||
GetDb() map[string]*gorm.DB
|
||||
GetDbByKey(key string) *gorm.DB
|
||||
|
||||
//单库业务实现这两个接口
|
||||
SetDb(db *DBConfig)
|
||||
GetDb() *DBConfig
|
||||
SetCasbin(key string, enforcer *casbin.SyncedEnforcer)
|
||||
GetCasbinKey(key string) *casbin.SyncedEnforcer
|
||||
|
||||
//使用的路由
|
||||
SetEngine(engine http.Handler)
|
||||
|
||||
Reference in new issue
Block a user