Documentation ¶
Index ¶
- Variables
- type CachedCodeRepository
- type CachedUserRepository
- func (r *CachedUserRepository) Create(ctx context.Context, u domain.User) error
- func (r *CachedUserRepository) FindByEmail(ctx context.Context, email string) (domain.User, error)
- func (r *CachedUserRepository) FindById(ctx context.Context, id int64) (domain.User, error)
- func (r *CachedUserRepository) FindByPhone(ctx context.Context, phone string) (domain.User, error)
- func (r *CachedUserRepository) FindByWechat(ctx context.Context, openID string) (domain.User, error)
- type CodeRepository
- type UserRepository
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
}
type CachedUserRepository ¶
type CachedUserRepository struct {
// contains filtered or unexported fields
}
func (*CachedUserRepository) FindByEmail ¶
func (*CachedUserRepository) FindByPhone ¶
func (*CachedUserRepository) FindByWechat ¶
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. |
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. |
Click to show internal directories.
Click to hide internal directories.