repository

package
v0.0.0-...-d13da26 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeSendTooMany        = cache.ErrCodeSendTooMany
	ErrCodeVerifyTooManyTimes = cache.ErrCodeVerifyTooManyTimes
)
View Source
var (
	ErrUserDuplicate = dao.ErrUserDuplicate
	ErrUserNotFound  = dao.ErrUserNotFound
)

Functions

This section is empty.

Types

type CachedCodeRepository

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

func (*CachedCodeRepository) Store

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

func (*CachedCodeRepository) Verify

func (repo *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 (*CachedUserRepository) FindByEmail

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

func (*CachedUserRepository) FindById

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

func (*CachedUserRepository) FindByPhone

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

func (*CachedUserRepository) FindByWechat

func (r *CachedUserRepository) FindByWechat(ctx context.Context, openID string) (domain.User, error)

type CodeRepository

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

func NewCodeRepository

func NewCodeRepository(c cache.CodeCache) CodeRepository

type UserRepository

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

UserRepository 是核心,它有不同实现。 但是 Factory 本身如果只是初始化一下,那么它不是你的核心

func NewUserRepository

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

Directories

Path Synopsis
mocks
Package artrepomocks is a generated GoMock package.
Package artrepomocks is a generated GoMock package.
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