repository

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeVerifyTooManyTimes = cache.ErrCodeVerifyTooManyTimes
	ErrCodeSendTooMany        = cache.ErrCodeSendTooMany
)

复用 cache 包中的错误

View Source
var (
	ErrUserDuplicateUser = dao.ErrUserDuplicate
	ErrUserNotFound      = dao.ErrDataNotFound
)

Functions

This section is empty.

Types

type CachedCodeRepository

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

func (*CachedCodeRepository) Store

func (cr *CachedCodeRepository) Store(ctx context.Context, biz, phone, code string) error

func (*CachedCodeRepository) Verify

func (cr *CachedCodeRepository) Verify(ctx context.Context, biz, phone, inputCode string) (bool, error)

type CachedUserRepository

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

func (*CachedUserRepository) Create

func (ur *CachedUserRepository) Create(ctx context.Context, user domain.User) error

func (*CachedUserRepository) FindByEmail

func (ur *CachedUserRepository) FindByEmail(ctx context.Context, email string) (domain.User, error)

func (*CachedUserRepository) FindById

func (ur *CachedUserRepository) FindById(ctx context.Context, id int64) (domain.User, error)

func (*CachedUserRepository) FindByIdV1

func (ur *CachedUserRepository) FindByIdV1(ctx context.Context, id int64) (domain.User, error)

func (*CachedUserRepository) FindByPhone

func (ur *CachedUserRepository) FindByPhone(ctx context.Context, phone string) (domain.User, error)

type CodeRepository

type CodeRepository interface {
	Store(ctx context.Context, biz, phone, code string) error
	Verify(ctx context.Context, biz, phone, inputCode string) (bool, error)
}

func NewCodeRepository

func NewCodeRepository(cache cache.CodeCache) CodeRepository

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user domain.User) error
	FindById(ctx context.Context, id int64) (domain.User, error)
	FindByEmail(ctx context.Context, email string) (domain.User, error)
	FindByPhone(ctx context.Context, phone string) (domain.User, error)
}

func NewUserRepository

func NewUserRepository(dao dao.UserDAO, cache cache.UserCache) UserRepository

Directories

Path Synopsis
mocks
Package cachemocks is a generated GoMock package.
Package cachemocks is a generated GoMock package.
redismocks
Package redismocks is a generated GoMock package.
Package redismocks is a generated GoMock package.
dao
mocks
Package daomocks is a generated GoMock package.
Package daomocks is a generated GoMock package.
Package repomocks is a generated GoMock package.
Package repomocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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