bll

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

type Demo struct {
	DemoModel model.IDemo `inject:"IDemo"`
}

Demo 示例程序

func (*Demo) Create

func (a *Demo) Create(ctx context.Context, item *schema.Demo) error

Create 创建数据

func (*Demo) Delete

func (a *Demo) Delete(ctx context.Context, recordID string) error

Delete 删除数据

func (*Demo) Get

func (a *Demo) Get(ctx context.Context, recordID string) (*schema.Demo, error)

Get 查询指定数据

func (*Demo) QueryPage

func (a *Demo) QueryPage(ctx context.Context, params schema.DemoQueryParam, pageIndex, pageSize uint) (int64, []*schema.DemoQueryResult, error)

QueryPage 查询分页数据

func (*Demo) Update

func (a *Demo) Update(ctx context.Context, recordID string, item *schema.Demo) error

Update 更新数据

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

func (a *Login) CheckIsRoot(ctx context.Context, recordID string) bool

CheckIsRoot 检查是否是超级用户

func (*Login) GetCurrentUserInfo

func (a *Login) GetCurrentUserInfo(ctx context.Context, userID string) (*schema.LoginInfo, error)

GetCurrentUserInfo 获取当前用户信息

func (*Login) QueryCurrentUserMenus

func (a *Login) QueryCurrentUserMenus(ctx context.Context, userID string) ([]map[string]interface{}, error)

QueryCurrentUserMenus 查询当前用户菜单

func (*Login) Verify

func (a *Login) Verify(ctx context.Context, userName, password string) (*schema.User, error)

Verify 登录验证

type Menu struct {
	MenuModel model.IMenu `inject:"IMenu"`
	// contains filtered or unexported fields
}

Menu 菜单管理

func (a *Menu) Create(ctx context.Context, item *schema.Menu) error

Create 创建数据

func (a *Menu) Delete(ctx context.Context, recordID string) error

Delete 删除数据

func (a *Menu) Get(ctx context.Context, recordID string) (*schema.Menu, error)

Get 查询指定数据

func (a *Menu) QueryPage(ctx context.Context, params schema.MenuQueryParam, pageIndex, pageSize uint) (int64, []*schema.MenuQueryResult, error)

QueryPage 查询分页数据

func (a *Menu) QueryTree(ctx context.Context, params schema.MenuSelectQueryParam) ([]map[string]interface{}, error)

QueryTree 查询菜单树

func (a *Menu) Update(ctx context.Context, recordID string, item *schema.Menu) error

Update 更新数据

func (a *Menu) UpdateStatus(ctx context.Context, recordID string, status int) error

UpdateStatus 更新状态

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) Create

func (a *Role) Create(ctx context.Context, item *schema.Role) error

Create 创建数据

func (*Role) Delete

func (a *Role) Delete(ctx context.Context, recordID string) error

Delete 删除数据

func (*Role) Get

func (a *Role) Get(ctx context.Context, recordID string) (*schema.Role, error)

Get 查询指定数据

func (*Role) LoadAllPolicy added in v1.1.0

func (a *Role) LoadAllPolicy() error

LoadAllPolicy 加载所有的角色策略

func (*Role) LoadPolicy added in v1.1.0

func (a *Role) LoadPolicy(ctx context.Context, roleID string) error

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

QuerySelect 查询选择数据

func (*Role) Update

func (a *Role) Update(ctx context.Context, recordID string, item *schema.Role) error

Update 更新数据

func (*Role) UpdateStatus

func (a *Role) UpdateStatus(ctx context.Context, recordID string, status int) error

UpdateStatus 更新状态

type User

type User struct {
	UserModel model.IUser      `inject:"IUser"`
	RoleModel model.IRole      `inject:"IRole"`
	Enforcer  *casbin.Enforcer `inject:""`
}

User 用户管理

func (*User) Create

func (a *User) Create(ctx context.Context, item *schema.User) error

Create 创建数据

func (*User) Delete

func (a *User) Delete(ctx context.Context, recordID string) error

Delete 删除数据

func (*User) Get

func (a *User) Get(ctx context.Context, recordID string) (*schema.User, error)

Get 查询指定数据

func (*User) LoadAllPolicy added in v1.1.0

func (a *User) LoadAllPolicy() error

LoadAllPolicy 加载所有的用户策略

func (*User) LoadPolicy added in v1.1.0

func (a *User) LoadPolicy(ctx context.Context, userID string) error

LoadPolicy 加载用户权限策略

func (*User) QueryPage

func (a *User) QueryPage(ctx context.Context, params schema.UserQueryParam, pageIndex, pageSize uint) (int64, []*schema.UserQueryResult, error)

QueryPage 查询分页数据

func (*User) Update

func (a *User) Update(ctx context.Context, recordID string, item *schema.User) error

Update 更新数据

func (*User) UpdateStatus

func (a *User) UpdateStatus(ctx context.Context, recordID string, status int) error

UpdateStatus 更新状态

Jump to

Keyboard shortcuts

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