service

package
v0.0.0-...-c234f5e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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
}

func (*SMSCodeService) Send

func (svc *SMSCodeService) Send(ctx context.Context, biz, phone string) error

func (*SMSCodeService) Verify

func (svc *SMSCodeService) Verify(ctx context.Context, biz, phone, code string) (bool, error)

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

func (us *UserServiceV1) FindById(ctx context.Context,
	uid int64) (domain.User, error)

func (*UserServiceV1) FindOrCreate

func (us *UserServiceV1) FindOrCreate(ctx context.Context, phone string) (domain.User, error)

func (*UserServiceV1) Login

func (us *UserServiceV1) Login(ctx context.Context, user domain.User) (domain.User, error)

func (*UserServiceV1) Profile

func (us *UserServiceV1) Profile(ctx context.Context, id int64) (domain.User, error)

func (*UserServiceV1) SignUp

func (us *UserServiceV1) SignUp(ctx context.Context, user domain.User) error

Directories

Path Synopsis
Package svcmocks is a generated GoMock package.
Package svcmocks is a generated GoMock package.
sms

Jump to

Keyboard shortcuts

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