manage

package
v0.0.0-...-a7f516c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

func NewChecker

func NewChecker(redisCli *redis.Client, uuid, prefix string) *Checker

func (*Checker) CheckConsist

func (c *Checker) CheckConsist(e *casbin.Enforcer) error

CheckConsist Check for consistency

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(client *redis.Client, d *gorm.DB, prefix, path string) (*Manager, error)

func (*Manager) AddRule

func (h *Manager) AddRule(ctx context.Context, pytepe string, rule []string) error

增加 增加直接用 casbin的增加即可,批量增加?也可以

func (*Manager) AddRules

func (h *Manager) AddRules(ctx context.Context, ptype string, rules [][]string) error

func (*Manager) AfterOp

func (h *Manager) AfterOp() error

在完成操作之后

func (*Manager) QuerryAll

func (h *Manager) QuerryAll(ctx context.Context) ([]po.CasbinRule, error)

管理服务无非就是增删查改

func (*Manager) QueryRuleById

func (h *Manager) QueryRuleById(ctx context.Context, id int) (*po.CasbinRule, error)

func (*Manager) QueryRuleByRule

func (h *Manager) QueryRuleByRule(ctx context.Context, ptype string, rule []string) ([]po.CasbinRule, error)

func (*Manager) QueryRulesByIds

func (h *Manager) QueryRulesByIds(ctx context.Context, ids []int) ([]po.CasbinRule, error)

func (*Manager) RemoveRuleById

func (h *Manager) RemoveRuleById(ctx context.Context, id int) error

删除操作,提供按照id删,和按照规则删

func (*Manager) RemoveRuleByIds

func (h *Manager) RemoveRuleByIds(ctx context.Context, ids []int) error

func (*Manager) RemoveRuleByRule

func (h *Manager) RemoveRuleByRule(ctx context.Context, ptype string, rule []string) error

func (*Manager) RemoveRuleByRules

func (h *Manager) RemoveRuleByRules(ctx context.Context, ptype string, rules [][]string) error

func (*Manager) UpdateRuleById

func (h *Manager) UpdateRuleById(ctx context.Context, id int, ptype string, ru []string) error

修改操作

func (*Manager) UpdateRulesByIds

func (h *Manager) UpdateRulesByIds(ctx context.Context, ids []int, ptype string, ru []string) error

func (*Manager) UpdateRulesByRule

func (h *Manager) UpdateRulesByRule(ctx context.Context, ptype string, ru []string, rule []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL