1 Star 0 Fork 0

cloudapex / permit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
route.go 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
cloudapex 提交于 2021-01-18 14:04 . restruct
package cache
/*******************************************************************************
Copyright:cloud
Author:cloudapex@126.com
Version:1.0
Date:2020-07-21
Description: 路由角色模型
*******************************************************************************/
import (
"encoding/json"
"fmt"
"gitee.com/cloudapex/ulern/rds"
)
type HRouteRole struct {
CoId int64 `json:"-"` // 公司Id
Route string `json:"-"` // 路由名称
RIds []int64 `json:"rIds"` // 此路由关联的角色Ids
Scopes []RoleScope `json:"scopes"` // 此路由关联的(不同角色对应的数据权限)
}
func (this *HRouteRole) Key() *rds.Hash {
return &rds.Hash{Key: rds.Key{
"MD_Permit", fmt.Sprintf("PERMIT_ROUTE_ROLES_%d", this.CoId), ""}}
}
func (this *HRouteRole) Load() error {
return this.Key().HGet(this.Route).Unmarshal(this)
}
func (this *HRouteRole) Store() error {
buf, _ := json.Marshal(this)
return this.Key().HSet(this.Route, buf).Error()
}
func (this *HRouteRole) Remove() error {
return this.Key().HDel(this.Route).Error()
}
func (this *HRouteRole) Clear() error {
return this.Key().Del().Error()
}
1
https://gitee.com/cloudapex/permit.git
git@gitee.com:cloudapex/permit.git
cloudapex
permit
permit
f047e65a7c44

搜索帮助