Documentation
¶
Index ¶
- type CasbinConf
- func (l CasbinConf) MustNewCasbin(dbType, dsn string) *casbin.Enforcer
- func (l CasbinConf) MustNewCasbinWithOriginalRedisWatcher(dbType, dsn string, c config.RedisConf) *casbin.Enforcer
- func (l CasbinConf) MustNewCasbinWithRedisWatcher(dbType, dsn string, c redis.RedisConf) *casbin.Enforcer
- func (l CasbinConf) MustNewOriginalRedisWatcher(c config.RedisConf, f func(string2 string)) persist.Watcher
- func (l CasbinConf) MustNewRedisWatcher(c redis.RedisConf, f func(string2 string)) persist.Watcher
- func (l CasbinConf) NewCasbin(dbType, dsn string) (*casbin.Enforcer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CasbinConf ¶
type CasbinConf struct {
ModelText string `json:"ModelText,optional,env=CASBIN_MODEL_TEXT"`
}
CasbinConf is the configuration structure for Casbin CasbinConf 是 Casbin 的配置结构
func (CasbinConf) MustNewCasbin ¶
func (l CasbinConf) MustNewCasbin(dbType, dsn string) *casbin.Enforcer
MustNewCasbin returns Casbin enforcer. If there are errors, it will exist.
func (CasbinConf) MustNewCasbinWithOriginalRedisWatcher ¶
func (l CasbinConf) MustNewCasbinWithOriginalRedisWatcher(dbType, dsn string, c config.RedisConf) *casbin.Enforcer
MustNewCasbinWithOriginalRedisWatcher returns Casbin Enforcer with original Redis watcher. MustNewCasbinWithOriginalRedisWatcher 返回带有原始 Redis 监视器的 Casbin Enforcer。
func (CasbinConf) MustNewCasbinWithRedisWatcher ¶
func (l CasbinConf) MustNewCasbinWithRedisWatcher(dbType, dsn string, c redis.RedisConf) *casbin.Enforcer
MustNewCasbinWithRedisWatcher returns Casbin Enforcer with Redis watcher. MustNewCasbinWithRedisWatcher 返回带有 Redis 监视器的 Casbin Enforcer。
func (CasbinConf) MustNewOriginalRedisWatcher ¶
func (l CasbinConf) MustNewOriginalRedisWatcher(c config.RedisConf, f func(string2 string)) persist.Watcher
MustNewOriginalRedisWatcher returns redis watcher which uses original go redis. If there are errors, it will exist. MustNewOriginalRedisWatcher 返回使用原始 go redis 的 redis 观察器。如果有错误,它将存在。 f function will be called if the policies are updated. 如果更新了策略,将调用 f 函数。
func (CasbinConf) MustNewRedisWatcher ¶
MustNewRedisWatcher returns redis watcher. If there are errors, it will exist. MustNewRedisWatcher 返回 redis 观察器。如果有错误,它将存在。 f function will be called if the policies are updated. 如果更新了策略,将调用 f 函数。
func (CasbinConf) NewCasbin ¶
func (l CasbinConf) NewCasbin(dbType, dsn string) (*casbin.Enforcer, error)
NewCasbin returns Casbin enforcer.