biz

package
v0.0.0-...-8f419a9 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT, MIT Imports: 10 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Permission

type Permission struct {
	ID        uint64
	Name      string
	Memo      string
	Path      string
	Method    string
	ParentID  uint64
	ParentIDS string
	CreateAt  string
	UpdateAt  string
}

Permission 角色

func (*Permission) ToProtoPermission

func (permission *Permission) ToProtoPermission() *v1.PermissionInfoResponse

ToProtoPermission 转换为proto结构体

type PermissionRepo

type PermissionRepo interface {
	Create(context.Context, *Permission) (*Permission, error)
	Update(context.Context, *Permission) (*Permission, error)
	Delete(context.Context, uint64) (*Permission, error)
	Get(context.Context, map[string]interface{}) (*Permission, error)
	List(context.Context, map[string]interface{}, map[string]bool, int64, int64) ([]*Permission, int64, error)
}

PermissionRepo 注意这一行新增的 mock 数据的命令

type PermissionUsecase

PermissionUsecase UserUsecase 角色业务逻辑接口

func NewPermissionUsecase

func NewPermissionUsecase(repo PermissionRepo, logger log.Logger) PermissionUsecase

NewPermissionUsecase 创建用户业务逻辑

type Role

type Role struct {
	ID       uint64
	Name     string
	Memo     string
	CreateAt string
	UpdateAt string
}

Role 角色

func (Role) ToProtoRole

func (role Role) ToProtoRole() *v1.RoleInfoResponse

ToProtoRole 转换为proto结构体

type RoleRepo

type RoleRepo interface {
	Create(context.Context, *Role) (*Role, error)
	Update(context.Context, *Role) (*Role, error)
	Delete(context.Context, uint64) (*Role, error)
	Get(context.Context, map[string]interface{}) (*Role, error)
	Query(context.Context, map[string]interface{}) ([]*Role, error)
	List(context.Context, map[string]interface{}, map[string]bool, int64, int64) ([]*Role, int64, error)
}

RoleRepo 注意这一行新增的 mock 数据的命令

type RoleUsecase

RoleUsecase UserUsecase 角色业务逻辑接口

func NewRoleUsecase

func NewRoleUsecase(repo RoleRepo, logger log.Logger) RoleUsecase

NewRoleUsecase 创建用户业务逻辑

type User

type User struct {
	ID       uint64
	Name     string
	Email    string
	Password string
	Status   int
	CreateAt string
	UpdateAt string
}

User 定义返回数据结构体

func (*User) ToProtoUser

func (user *User) ToProtoUser() *v1.UserInfoResponse

ToProtoUser 转换为proto结构体

type UserRepo

type UserRepo interface {
	CreateUser(context.Context, *User) (*User, error)
	UpdateUser(context.Context, *User) (*User, error)
	DeleteUser(context.Context, uint64) (*User, error)
	GetUser(context.Context, map[string]interface{}) (*User, error)
	ListUser(ctx context.Context, where map[string]interface{}, page, pageSize int64) ([]*User, int64, error)
	QueryUserRole(ctx context.Context, where map[string]interface{}) (*UserRole, error)
	CreateUserRole(ctx context.Context, ur *UserRole) (*UserRole, error)
	DeleteUserRole(ctx context.Context, id uint64) error
}

UserRepo 注意这一行新增的 mock 数据的命令

type UserRole

type UserRole struct {
	ID     uint64
	UserID uint64
	RoleID uint64
}

UserRole 定义返回数据结构体

type UserUsecase

type UserUsecase interface {
	Create(ctx context.Context, user *User) (*User, error)
	Update(ctx context.Context, user *User) (*User, error)
	Delete(ctx context.Context, id uint64) (*User, error)
	Get(ctx context.Context, where map[string]interface{}) (*User, error)
	List(ctx context.Context, where map[string]interface{}, page, pageSize int64) ([]*User, int64, error)
	CreateToken(ctx context.Context, email, password string) (string, error)
	SetUserRole(ctx context.Context, userId uint64, roleIds []uint64) error
	DeleteUserRole(ctx context.Context, userId uint64, roleIds []uint64) error
}

UserUsecase 用户业务逻辑接口

func NewUserUsecase

func NewUserUsecase(repo UserRepo, roleRepo RoleRepo, ac *conf.Auth, logger log.Logger) UserUsecase

NewUserUsecase 创建用户业务逻辑

Jump to

Keyboard shortcuts

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