biz

package
v0.0.0-...-96f2668 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRoleNotFound is user not found.
	ErrRoleNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
)
View Source
var (
	// ErrUserNotFound is user not found.
	ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type AuthRepo

type AuthRepo interface {
	// 用户认证
	Register(context.Context, *v1.RegisterRequest) error
	Logout(context.Context) error
	LoginByPassword(context.Context, *v1.LoginByPasswordRequest) (*v1.LoginResponse, error)
	// 访问用户相关
	GetAuthInfo(context.Context) (*v1.GetAuthInfoResponse, error)
}

AuthRepo is a Greater repo.

type AuthUsecase

type AuthUsecase struct {
	// contains filtered or unexported fields
}

AuthUsecase is a User usecase.

func NewAuthUsecase

func NewAuthUsecase(repo AuthRepo, logger log.Logger) *AuthUsecase

NewAuthUsecase new a User usecase.

func (*AuthUsecase) GetAuthInfo

func (ac *AuthUsecase) GetAuthInfo(ctx context.Context) (*v1.GetAuthInfoResponse, error)

GetInfo 用户信息

func (*AuthUsecase) LoginByPassword

func (ac *AuthUsecase) LoginByPassword(ctx context.Context, pb *v1.LoginByPasswordRequest) (*v1.LoginResponse, error)

Login 登录-密码登录

func (*AuthUsecase) Logout

func (ac *AuthUsecase) Logout(ctx context.Context) error

Login 登录-密码登录

func (*AuthUsecase) Register

func (ac *AuthUsecase) Register(ctx context.Context, pb *v1.RegisterRequest) error

Login 登录-密码登录

type LoginResult

type LoginResult struct {
	Token        string
	RefreshToken string
	ExpiresAt    *time.Time
}

type Role

type Role struct {
	Hello string
}

Role is a Role model.

type RoleRepo

type RoleRepo interface {
	Save(context.Context, *Role) (*Role, error)
	Update(context.Context, *Role) (*Role, error)
	FindByID(context.Context, int64) (*Role, error)
	ListByName(context.Context, string) ([]*Role, error)
	ListAll(context.Context) ([]*Role, error)
}

RoleRepo is a Greater repo.

type RoleUsecase

type RoleUsecase struct {
	// contains filtered or unexported fields
}

RoleUsecase is a Role usecase.

func NewRoleUsecase

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

NewRoleUsecase new a Role usecase.

func (*RoleUsecase) CreateRole

func (uc *RoleUsecase) CreateRole(ctx context.Context, g *Role) (*Role, error)

CreateRole creates a Role, and returns the new Role.

type Transaction

type Transaction interface {
	InTx(context.Context, func(ctx context.Context) error) error
}

type User

type User struct {
	Hello string
}

User is a User model.

type UserRepo

type UserRepo interface {
	Save(context.Context, *User) (*User, error)
	Update(context.Context, *User) (*User, error)
	FindByID(context.Context, int64) (*User, error)
	ListByName(context.Context, string) ([]*User, error)
	ListAll(context.Context) ([]*User, error)
}

UserRepo is a Greater repo.

type UserUsecase

type UserUsecase struct {
	// contains filtered or unexported fields
}

UserUsecase is a User usecase.

func NewUserUsecase

func NewUserUsecase(repo UserRepo, logger log.Logger) *UserUsecase

NewUserUsecase new a User usecase.

func (*UserUsecase) CreateUser

func (uc *UserUsecase) CreateUser(ctx context.Context, g *User) (*User, error)

CreateUser creates a User, and returns the new User.

Jump to

Keyboard shortcuts

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