Documentation ¶
Index ¶
- Constants
- type Adapter
- func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) LoadPolicy(model model.Model) error
- func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) SavePolicy(model model.Model) error
- func (a *Adapter) WithTx(fn func(tx *ent.Tx) error) error
- type Option
Constants ¶
const ( DefaultTableName = "casbin_rule" DefaultDatabase = "casbin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func NewAdapter ¶
NewAdapter returns an adapter by driver name and data source string.
func NewAdapterWithClient ¶
NewAdapterWithClient create an adapter with client passed in. This method does not ensure the existence of database, user should create database manually.
func (*Adapter) AddPolicies ¶
AddPolicies adds policy rules to the storage. This is part of the Auto-Save feature.
func (*Adapter) AddPolicy ¶
AddPolicy adds a policy rule to the storage. This is part of the Auto-Save feature.
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. This is part of the Auto-Save feature.
func (*Adapter) RemovePolicies ¶
RemovePolicies removes policy rules from the storage. This is part of the Auto-Save feature.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage. This is part of the Auto-Save feature.
func (*Adapter) SavePolicy ¶
SavePolicy saves all policy rules to the storage.