Documentation
¶
Index ¶
- Variables
- type CodeService
- type SMSCodeService
- type UserService
- type UserServiceV1
- func (us *UserServiceV1) FindById(ctx context.Context, uid int64) (domain.User, error)
- func (us *UserServiceV1) FindOrCreate(ctx context.Context, phone string) (domain.User, error)
- func (us *UserServiceV1) Login(ctx context.Context, user domain.User) (domain.User, error)
- func (us *UserServiceV1) Profile(ctx context.Context, id int64) (domain.User, error)
- func (us *UserServiceV1) SignUp(ctx context.Context, user domain.User) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCodeSendTooMany = repository.ErrCodeSendTooMany ErrCodeVerifyTooManyTimes = repository.ErrCodeVerifyTooManyTimes )
View Source
var ( ErrUserDuplicateUser = repository.ErrUserDuplicateUser // 不能直接告诉用户是密码错误还是邮箱错误, 否则会泄露用户信息 ErrInvalidUserOrPassword = errors.New("invalid email or password") )
Functions ¶
This section is empty.
Types ¶
type CodeService ¶
type CodeService interface { Send(ctx context.Context, biz, phone string) error Verify(ctx context.Context, biz, phone, code string) (bool, error) }
func NewCodeService ¶
func NewCodeService(repo repository.CodeRepository, sms sms.Service) CodeService
type SMSCodeService ¶
type SMSCodeService struct {
// contains filtered or unexported fields
}
type UserService ¶
type UserService interface { SignUp(ctx context.Context, user domain.User) error Login(ctx context.Context, user domain.User) (domain.User, error) Profile(ctx context.Context, id int64) (domain.User, error) FindOrCreate(ctx context.Context, phone string) (domain.User, error) FindById(ctx context.Context, uid int64) (domain.User, error) }
func NewUserService ¶
func NewUserService(repo repository.UserRepository) UserService
type UserServiceV1 ¶
type UserServiceV1 struct {
// contains filtered or unexported fields
}
func (*UserServiceV1) FindOrCreate ¶
Click to show internal directories.
Click to hide internal directories.