Documentation ¶
Index ¶
- Variables
- type Auth
- type AuthRepo
- type AuthUseCase
- func (uc *AuthUseCase) Captcha(_ context.Context, uuid string) (string, error)
- func (uc *AuthUseCase) CheckRisk(ctx context.Context, account string) bool
- func (uc *AuthUseCase) CreateUserToken(up myctx.JwtProfile, ut string) (string, error)
- func (uc *AuthUseCase) GetUser(ctx context.Context, uid uint32) (*User, error)
- func (uc *AuthUseCase) LoginForPassword(ctx context.Context, account, passwd string) (*User, error)
- func (uc *AuthUseCase) ParseUserToken(ctx context.Context, tokenString string) (*myctx.JwtCustomClaims, error)
- func (uc *AuthUseCase) RefreshUserToken(ctx context.Context, tokenString string) (string, error)
- func (uc *AuthUseCase) UpdatePassword(ctx context.Context, account, passwd, oldPasswd string) error
- func (uc *AuthUseCase) ValidateCaptcha(_ context.Context, uuid, code string) bool
- type ListOption
- type ListUserOption
- type OrderBy
- type User
- type UserRepo
- type UserUseCase
- func (uc *UserUseCase) CreateUser(ctx context.Context, user *User) (*User, error)
- func (uc *UserUseCase) DelUser(ctx context.Context, uid uint32) error
- func (uc *UserUseCase) GetUser(ctx context.Context, uid uint32) (*User, error)
- func (uc *UserUseCase) ListUser(ctx context.Context, op ListUserOption) ([]*User, int64, error)
- func (uc *UserUseCase) UpdateUser(ctx context.Context, uid uint32, user *User) (*User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet( storage.ProviderSet, NewAuthUseCase, NewUserUseCase, )
ProviderSet is service providers.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { Id uint32 Account string Password string Salt string Role string LastIp string LastLoginTime *time.Time }
认证信息实体
type AuthUseCase ¶
type AuthUseCase struct {
// contains filtered or unexported fields
}
认证用例
func NewAuthUseCase ¶
wire 创建认证用例接口
func (*AuthUseCase) CheckRisk ¶
func (uc *AuthUseCase) CheckRisk(ctx context.Context, account string) bool
风险检查
func (*AuthUseCase) CreateUserToken ¶
func (uc *AuthUseCase) CreateUserToken(up myctx.JwtProfile, ut string) (string, error)
创建token
func (*AuthUseCase) LoginForPassword ¶
密码登录
func (*AuthUseCase) ParseUserToken ¶
func (uc *AuthUseCase) ParseUserToken(ctx context.Context, tokenString string) (*myctx.JwtCustomClaims, error)
解析token
func (*AuthUseCase) RefreshUserToken ¶
刷新token
func (*AuthUseCase) UpdatePassword ¶
func (uc *AuthUseCase) UpdatePassword(ctx context.Context, account, passwd, oldPasswd string) error
修改密码
func (*AuthUseCase) ValidateCaptcha ¶
func (uc *AuthUseCase) ValidateCaptcha(_ context.Context, uuid, code string) bool
图形验证码验证
type ListOption ¶
type ListOption struct { // 排序字段 OrderField string // 是否倒序 true desc false asc OrderDesc bool // 更多排序 OrderMore []OrderBy // 页码 Page uint32 // 分页大小 PageSize uint32 // 不分页 NoPage bool }
基础列表查询选项
func NewListOption ¶
func NewListOption(option *v1.ListOption) ListOption
type ListUserOption ¶
type ListUserOption struct { Id uint32 Keyword string Role string Account string ListOption }
用户查询选项
type User ¶
type User struct { Id uint32 Name string Phone string Email string // 认证相关信息 AuthId uint32 Auth *Auth CreatedAt time.Time UpdatedAt time.Time }
用户结构
type UserRepo ¶
type UserRepo interface { // 获取用户 GetUser(ctx context.Context, op ListUserOption) (*User, error) // 用户列表 ListUser(ctx context.Context, op ListUserOption) ([]*User, int64, error) // 存储新用户 创建新的认证信息 CreateUser(ctx context.Context, user *User) (*User, error) // 更新认证信息 UpdateAuth(ctx context.Context, id uint32, auth *Auth) (*Auth, error) // 更新用户 UpdateUser(ctx context.Context, id uint32, user *User) (*User, error) // 删除用户 同时删除认证信息 DeleteUser(ctx context.Context, uid uint32) error }
type UserUseCase ¶
type UserUseCase struct {
// contains filtered or unexported fields
}
func NewUserUseCase ¶
func NewUserUseCase(userRepo UserRepo) *UserUseCase
func (*UserUseCase) CreateUser ¶
创建用户
func (*UserUseCase) DelUser ¶
func (uc *UserUseCase) DelUser(ctx context.Context, uid uint32) error
删除用户
func (*UserUseCase) ListUser ¶
func (uc *UserUseCase) ListUser(ctx context.Context, op ListUserOption) ([]*User, int64, error)
用户列表
func (*UserUseCase) UpdateUser ¶
修改用户信息
Click to show internal directories.
Click to hide internal directories.