Documentation
¶
Index ¶
- 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
- type CasbinRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter represents the gdb adapter for policy storage. Adapter 代表用于策略存储的gdb适配器。
func NewAdapter ¶
NewAdapter是Adapter的构造函数。 dbSpecified是可选的bool参数。 默认值为false。 如果dbSpecified == true,则需要确保dataSourceName中的数据库存在。 如果dbSpecified == false,则适配器将自动创建一个名为“ casbin”的数据库。
func NewAdapterByDB ¶
NewAdapterByDB is the constructor for Adapter.Need to pass in gdb.DB NewAdapterByDB 是Adapter的构造函数,需要传入gdb.DB
func NewAdapterFromOptions ¶
NewAdapterFromOptions is the constructor for Adapter with existed connection NewAdapterFromOptions 适配器的构造函数是否具有已存在的连接
func (*Adapter) AddPolicies ¶
func (*Adapter) LoadPolicy ¶
LoadPolicy loads policy from database. LoadPolicy 从数据库加载策略。
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. RemoveFilteredPolicy 从存储中删除与筛选器匹配的策略规则。
func (*Adapter) RemovePolicies ¶
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage. RemovePolicy 从存储中删除策略规则。
type CasbinRule ¶
type CasbinRule struct { PType string `orm:"ptype" json:"ptype"` V0 string `orm:"v0" json:"v0"` V1 string `orm:"v1" json:"v1"` V2 string `orm:"v2" json:"v2"` V3 string `orm:"v3" json:"v3"` V4 string `orm:"v4" json:"v4"` V5 string `orm:"v5" json:"v5"` }
func (*CasbinRule) TableName ¶
func (c *CasbinRule) TableName() string