Documentation ¶
Index ¶
- Constants
- type Adapter
- func (a *Adapter) AddPolicy(_ string, ptype string, rule []string) (err error)
- func (a *Adapter) LoadPolicy(model model.Model) (err error)
- func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *Adapter) RemovePolicy(_ string, ptype string, rule []string) (err error)
- func (a *Adapter) SavePolicy(model model.Model) (err error)
Constants ¶
View Source
const (
// The key under which the policies are stored in redis
PolicyKey = "casbin:policy"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is an adapter for policy storage based on Redis
func NewFromClient ¶
func NewFromClient(redisCli *redis.Client) (adapter *Adapter)
NewFromClient returns a new instance of Adapter from an already existing go-redis client.
func NewFromURL ¶
NewFromDSN returns a new Adapter by using the given DSN. Format: redis://:{password}@{host}:{port}/{database} Example: redis://:123@localhost:6379/0
func (*Adapter) LoadPolicy ¶
LoadPolicy loads all policy rules from the storage.
func (*Adapter) RemoveFilteredPolicy ¶
func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy removes policy rules that match the filter from the storage.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.
Click to show internal directories.
Click to hide internal directories.