Documentation
¶
Index ¶
- Variables
- func NewApiRepo(data *Data, logger log.Logger) biz.ApiRepo
- func NewCasbinRepo(data *Data, conf *conf.Bootstrap, logger log.Logger) biz.CasbinRepo
- func NewMenuRepo(data *Data, logger log.Logger) biz.MenuRepo
- func NewMysqlCmd(conf *conf.Bootstrap, logger log.Logger) *gorm.DB
- func NewRedisClient(conf *conf.Data) *redis.Client
- func NewRedisCmd(conf *conf.Data, logger log.Logger) redis.Cmdable
- func NewRoleRepo(data *Data, logger log.Logger) biz.RoleRepo
- func Paginate(page, pageSize int64) func(db *gorm.DB) *gorm.DB
- type ApiEntity
- type ApiRepo
- func (repo ApiRepo) CreateApi(ctx context.Context, api *domain.Api) (*domain.Api, error)
- func (repo ApiRepo) DeleteApi(ctx context.Context, domain *domain.Api) error
- func (repo ApiRepo) GetApi(ctx context.Context, params map[string]interface{}) (*domain.Api, error)
- func (repo ApiRepo) GetApiByParams(ctx context.Context, params map[string]interface{}) (record *ApiEntity, err error)
- func (repo ApiRepo) GetApiCount(ctx context.Context, params map[string]interface{}) int64
- func (repo ApiRepo) ListApi(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Api, int64, error)
- func (repo ApiRepo) ListApiAll(ctx context.Context) ([]*domain.Api, error)
- func (repo ApiRepo) UpdateApi(ctx context.Context, api *domain.Api) error
- type BaseFields
- type CasbinEntity
- type CasbinRepo
- func (a CasbinRepo) CheckAuthorization(ctx context.Context, sub, obj, act string) (bool, error)
- func (r CasbinRepo) DeleteRoleForUser(ctx context.Context, username string, Casbin string) (bool, error)
- func (r CasbinRepo) DeleteRolesForUser(ctx context.Context, username string) (bool, error)
- func (r CasbinRepo) GetPolicies(ctx context.Context, role string) ([]*biz.PolicyRules, error)
- func (r CasbinRepo) GetRolesForUser(ctx context.Context, username string) ([]string, error)
- func (r CasbinRepo) GetUsersForRole(ctx context.Context, Casbin string) ([]string, error)
- func (r CasbinRepo) SetRolesForUser(ctx context.Context, username string, Roles []string) (bool, error)
- func (r CasbinRepo) UpdatePolicies(ctx context.Context, role string, rules []biz.PolicyRules) (bool, error)
- type Data
- type MenuBtnEntity
- type MenuEntity
- type MenuRepo
- func (r MenuRepo) CreateMenu(ctx context.Context, reqData *domain.Menu) (*domain.Menu, error)
- func (r MenuRepo) DeleteMenu(ctx context.Context, id int64) error
- func (r MenuRepo) GetMenuAll(ctx context.Context) ([]*domain.Menu, error)
- func (r MenuRepo) GetMenuTree(ctx context.Context) ([]*domain.Menu, error)
- func (r MenuRepo) GetRoleMenu(ctx context.Context, role string) ([]*domain.Menu, error)
- func (r MenuRepo) GetRoleMenuBtn(ctx context.Context, roleId int64, roleName string, menuId int64) (response []*domain.MenuBtn, err error)
- func (r MenuRepo) GetRoleMenuTree(ctx context.Context, role string) ([]*domain.Menu, error)
- func (r MenuRepo) SaveRoleMenu(ctx context.Context, roleId int64, menuIds []int64) error
- func (r MenuRepo) SaveRoleMenuBtn(ctx context.Context, roleId int64, menuId int64, btnIds []int64) error
- func (r MenuRepo) UpdateMenu(ctx context.Context, reqData *domain.Menu) error
- type RoleEntity
- type RoleMenuBtnEntity
- type RoleMenuEntity
- type RoleRepo
- func (r RoleRepo) CreateRole(ctx context.Context, role *domain.Role) (*domain.Role, error)
- func (r RoleRepo) DeleteRole(ctx context.Context, role *domain.Role) error
- func (r RoleRepo) GetRole(ctx context.Context, params map[string]interface{}) (*domain.Role, error)
- func (r RoleRepo) GetRoleByParams(ctx context.Context, params map[string]interface{}) (record *RoleEntity, err error)
- func (r RoleRepo) ListRoleAll(ctx context.Context) ([]*domain.Role, error)
- func (r RoleRepo) UpdateRole(ctx context.Context, role *domain.Role) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewData, NewRedisCmd, NewMysqlCmd, NewRedisClient, NewRoleRepo, NewApiRepo, NewCasbinRepo, NewMenuRepo, )
ProviderSet is data providers.
Functions ¶
func NewCasbinRepo ¶
Types ¶
type ApiEntity ¶
type ApiEntity struct { BaseFields Domain string `gorm:"type:varchar(255);not null;comment:所在域"` Name string `gorm:"type:varchar(255);not null;comment:名称"` Group string `gorm:"type:varchar(255);not null;comment:分组"` Method string `gorm:"type:varchar(255);not null;comment:请求方式"` Path string `gorm:"type:varchar(255);not null;comment:请求路径"` }
type ApiRepo ¶
type ApiRepo struct {
// contains filtered or unexported fields
}
func (ApiRepo) GetApiByParams ¶
func (ApiRepo) GetApiCount ¶
func (ApiRepo) ListApiAll ¶
type BaseFields ¶
type CasbinEntity ¶
type CasbinEntity struct { ID int64 `json:"id"` PType string `json:"ptype" gorm:"column:p_type" ` Role string `json:"role_name" gorm:"column:v0" ` Path string `json:"path" gorm:"column:v1" ` Method string `json:"method" gorm:"column:v2" ` }
func (CasbinEntity) TableName ¶
func (CasbinEntity) TableName() string
type CasbinRepo ¶
type CasbinRepo struct {
// contains filtered or unexported fields
}
func (CasbinRepo) CheckAuthorization ¶
func (CasbinRepo) DeleteRoleForUser ¶
func (CasbinRepo) DeleteRolesForUser ¶
func (CasbinRepo) GetPolicies ¶
func (r CasbinRepo) GetPolicies(ctx context.Context, role string) ([]*biz.PolicyRules, error)
func (CasbinRepo) GetRolesForUser ¶
func (CasbinRepo) GetUsersForRole ¶
func (CasbinRepo) SetRolesForUser ¶
func (CasbinRepo) UpdatePolicies ¶
func (r CasbinRepo) UpdatePolicies(ctx context.Context, role string, rules []biz.PolicyRules) (bool, error)
type MenuBtnEntity ¶
type MenuBtnEntity struct { Id int64 `gorm:"primarykey;type:int;comment:主键id"` Domain string `gorm:"type:varchar(255);not null;comment:所在域"` MenuId int64 `gorm:"type:int;comment:菜单id"` Name string `gorm:"type:varchar(255);not null;comment:按钮名称"` Description string `gorm:"type:varchar(255);not null;comment:描述"` Identifier string `gorm:"type:varchar(255);not null;comment:英文标识"` CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间"` UpdatedAt time.Time `gorm:"column:updated_at;not null;comment:更新时间"` }
func (MenuBtnEntity) TableName ¶
func (MenuBtnEntity) TableName() string
type MenuEntity ¶
type MenuEntity struct { BaseFields Domain string `gorm:"type:varchar(255);not null;comment:所在域"` ParentId int64 `gorm:"type:int;comment:父级id"` ParentIds string `gorm:"type:varchar(255);comment:父级id字符串 英文逗号分割"` Name string `gorm:"type:varchar(255);not null;comment:菜单名"` Path string `gorm:"type:varchar(255);not null;comment:前端路径"` Hidden bool `gorm:"not null;comment:是否隐藏 0否1是"` Component string `gorm:"type:varchar(255);not null;comment:前端文件路径"` Sort int64 `gorm:"type:int;comment:排序"` Title string `gorm:"type:varchar(255);not null;comment:页面名称"` Icon string `gorm:"type:varchar(255);not null;comment:菜单图标"` MenuBtns []*MenuBtnEntity `gorm:"foreignKey:menu_id;"` Children []MenuEntity `gorm:"-"` }
func (MenuEntity) TableName ¶
func (MenuEntity) TableName() string
type MenuRepo ¶
type MenuRepo struct {
// contains filtered or unexported fields
}
func (MenuRepo) CreateMenu ¶
func (MenuRepo) GetMenuAll ¶
func (MenuRepo) GetMenuTree ¶
func (MenuRepo) GetRoleMenu ¶
func (MenuRepo) GetRoleMenuBtn ¶
func (MenuRepo) GetRoleMenuTree ¶
func (MenuRepo) SaveRoleMenu ¶
func (MenuRepo) SaveRoleMenuBtn ¶
type RoleEntity ¶
type RoleEntity struct { BaseFields Domain string `gorm:"type:varchar(255);not null;comment:所在域"` Name string `gorm:"type:varchar(255);not null;comment:名称"` }
func (RoleEntity) TableName ¶
func (RoleEntity) TableName() string
type RoleMenuBtnEntity ¶
type RoleMenuBtnEntity struct { Id int64 `gorm:"primarykey;type:int;comment:主键id"` Domain string `gorm:"type:varchar(255);not null;comment:所在域"` RoleId int64 `gorm:"type:int;comment:角色id"` MenuId int64 `gorm:"type:int;comment:菜单id"` BtnId int64 `gorm:"type:int;comment:按钮id"` }
func (RoleMenuBtnEntity) TableName ¶
func (RoleMenuBtnEntity) TableName() string
type RoleMenuEntity ¶
type RoleMenuEntity struct { Id int64 `gorm:"primarykey;type:int;comment:主键id"` Domain string `gorm:"type:varchar(255);not null;comment:所在域"` RoleId int64 `gorm:"type:int;comment:角色id"` MenuId int64 `gorm:"type:int;comment:菜单id"` }
func (RoleMenuEntity) TableName ¶
func (RoleMenuEntity) TableName() string
type RoleRepo ¶
type RoleRepo struct {
// contains filtered or unexported fields
}
func (RoleRepo) CreateRole ¶
func (RoleRepo) DeleteRole ¶
func (RoleRepo) GetRoleByParams ¶
func (RoleRepo) ListRoleAll ¶
Click to show internal directories.
Click to hide internal directories.