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
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.
func (CasbinConf) MustNewCasbinWithRedisWatcher ¶
func (l CasbinConf) MustNewCasbinWithRedisWatcher(dbType, dsn string, c redis.RedisConf) *casbin.Enforcer
MustNewCasbinWithRedisWatcher returns Casbin Enforcer with Redis watcher.
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. f function will be called if the policies are updated.
func (CasbinConf) MustNewRedisWatcher ¶
MustNewRedisWatcher returns redis watcher. If there are errors, it will exist. f function will be called if the policies are updated.
func (CasbinConf) NewCasbin ¶
func (l CasbinConf) NewCasbin(dbType, dsn string) (*casbin.Enforcer, error)
NewCasbin returns Casbin enforcer.