Documentation ¶
Index ¶
- Variables
- type Demo
- func (a *Demo) Create(ctx context.Context, item *schema.Demo) error
- func (a *Demo) Delete(ctx context.Context, recordID string) error
- func (a *Demo) Get(ctx context.Context, recordID string) (*schema.Demo, error)
- func (a *Demo) QueryPage(ctx context.Context, params schema.DemoQueryParam, pageIndex, pageSize uint) (int64, []*schema.DemoQueryResult, error)
- func (a *Demo) Update(ctx context.Context, recordID string, item *schema.Demo) error
- type Login
- func (a *Login) CheckIsRoot(ctx context.Context, recordID string) bool
- func (a *Login) GetCurrentUserInfo(ctx context.Context, userID string) (*schema.LoginInfo, error)
- func (a *Login) QueryCurrentUserMenus(ctx context.Context, userID string) ([]map[string]interface{}, error)
- func (a *Login) Verify(ctx context.Context, userName, password string) (*schema.User, error)
- type Menu
- func (a *Menu) Create(ctx context.Context, item *schema.Menu) error
- func (a *Menu) Delete(ctx context.Context, recordID string) error
- func (a *Menu) Get(ctx context.Context, recordID string) (*schema.Menu, error)
- func (a *Menu) QueryPage(ctx context.Context, params schema.MenuQueryParam, pageIndex, pageSize uint) (int64, []*schema.MenuQueryResult, error)
- func (a *Menu) QueryTree(ctx context.Context, params schema.MenuSelectQueryParam) ([]map[string]interface{}, error)
- func (a *Menu) Update(ctx context.Context, recordID string, item *schema.Menu) error
- func (a *Menu) UpdateStatus(ctx context.Context, recordID string, status int) error
- type Role
- func (a *Role) Create(ctx context.Context, item *schema.Role) error
- func (a *Role) Delete(ctx context.Context, recordID string) error
- func (a *Role) Get(ctx context.Context, recordID string) (*schema.Role, error)
- func (a *Role) LoadAllPolicy() error
- func (a *Role) LoadPolicy(ctx context.Context, roleID string) error
- func (a *Role) QueryPage(ctx context.Context, params schema.RoleQueryParam, pageIndex, pageSize uint) (int64, []*schema.RoleQueryResult, error)
- func (a *Role) QuerySelect(ctx context.Context, params schema.RoleSelectQueryParam) ([]*schema.RoleSelectQueryResult, error)
- func (a *Role) Update(ctx context.Context, recordID string, item *schema.Role) error
- func (a *Role) UpdateStatus(ctx context.Context, recordID string, status int) error
- type User
- func (a *User) Create(ctx context.Context, item *schema.User) error
- func (a *User) Delete(ctx context.Context, recordID string) error
- func (a *User) Get(ctx context.Context, recordID string) (*schema.User, error)
- func (a *User) LoadAllPolicy() error
- func (a *User) LoadPolicy(ctx context.Context, userID string) error
- func (a *User) QueryPage(ctx context.Context, params schema.UserQueryParam, pageIndex, pageSize uint) (int64, []*schema.UserQueryResult, error)
- func (a *User) Update(ctx context.Context, recordID string, item *schema.User) error
- func (a *User) UpdateStatus(ctx context.Context, recordID string, status int) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidUser = errors.New("无效的用户") ErrInvalidUserName = errors.New("无效的用户名") ErrInvalidPassword = errors.New("无效的密码") ErrUserDisable = errors.New("用户被禁用") )
定义错误
Functions ¶
This section is empty.
Types ¶
type Demo ¶
Demo 示例程序
type Login ¶
type Login struct { UserModel model.IUser `inject:"IUser"` RoleModel model.IRole `inject:"IRole"` MenuModel model.IMenu `inject:"IMenu"` }
Login 登录管理
func (*Login) CheckIsRoot ¶ added in v1.1.0
CheckIsRoot 检查是否是超级用户
func (*Login) GetCurrentUserInfo ¶
GetCurrentUserInfo 获取当前用户信息
type Menu ¶
type Menu struct { MenuModel model.IMenu `inject:"IMenu"` // contains filtered or unexported fields }
Menu 菜单管理
func (*Menu) QueryPage ¶
func (a *Menu) QueryPage(ctx context.Context, params schema.MenuQueryParam, pageIndex, pageSize uint) (int64, []*schema.MenuQueryResult, error)
QueryPage 查询分页数据
func (*Menu) QueryTree ¶
func (a *Menu) QueryTree(ctx context.Context, params schema.MenuSelectQueryParam) ([]map[string]interface{}, error)
QueryTree 查询菜单树
type Role ¶
type Role struct { RoleModel model.IRole `inject:"IRole"` MenuModel model.IMenu `inject:"IMenu"` UserModel model.IUser `inject:"IUser"` Enforcer *casbin.Enforcer `inject:""` }
Role 角色管理
func (*Role) LoadAllPolicy ¶ added in v1.1.0
LoadAllPolicy 加载所有的角色策略
func (*Role) LoadPolicy ¶ added in v1.1.0
LoadPolicy 加载角色权限策略
func (*Role) QueryPage ¶
func (a *Role) QueryPage(ctx context.Context, params schema.RoleQueryParam, pageIndex, pageSize uint) (int64, []*schema.RoleQueryResult, error)
QueryPage 查询分页数据
func (*Role) QuerySelect ¶
func (a *Role) QuerySelect(ctx context.Context, params schema.RoleSelectQueryParam) ([]*schema.RoleSelectQueryResult, error)
QuerySelect 查询选择数据
type User ¶
type User struct { UserModel model.IUser `inject:"IUser"` RoleModel model.IRole `inject:"IRole"` Enforcer *casbin.Enforcer `inject:""` }
User 用户管理
func (*User) LoadAllPolicy ¶ added in v1.1.0
LoadAllPolicy 加载所有的用户策略
func (*User) LoadPolicy ¶ added in v1.1.0
LoadPolicy 加载用户权限策略
func (*User) QueryPage ¶
func (a *User) QueryPage(ctx context.Context, params schema.UserQueryParam, pageIndex, pageSize uint) (int64, []*schema.UserQueryResult, error)
QueryPage 查询分页数据
Click to show internal directories.
Click to hide internal directories.