Documentation
¶
Index ¶
- Variables
- type CachedCodeRepository
- type CachedReadCntRepository
- func (c *CachedReadCntRepository) AddCollectionItem(ctx context.Context, biz string, bizId, cid, uid int64) error
- func (c *CachedReadCntRepository) Collected(ctx context.Context, biz string, id int64, uid int64) (bool, error)
- func (c *CachedReadCntRepository) DecrLike(ctx context.Context, biz string, bizId int64, uid int64) error
- func (c *CachedReadCntRepository) Get(ctx context.Context, biz string, bizId int64) (domain.Interactive, error)
- func (c *CachedReadCntRepository) GetCollection() (domain.Collection, error)
- func (c *CachedReadCntRepository) IncrLike(ctx context.Context, biz string, bizId int64, uid int64) error
- func (c *CachedReadCntRepository) IncrReadCnt(ctx context.Context, biz string, bizId int64) error
- func (c *CachedReadCntRepository) Liked(ctx context.Context, biz string, id int64, uid int64) (bool, error)
- type CachedUserRepository
- func (ur *CachedUserRepository) Create(ctx context.Context, u domain.User) error
- func (ur *CachedUserRepository) FindByEmail(ctx context.Context, email string) (domain.User, error)
- func (ur *CachedUserRepository) FindById(ctx context.Context, id int64) (domain.User, error)
- func (ur *CachedUserRepository) FindByPhone(ctx context.Context, phone string) (domain.User, error)
- func (r *CachedUserRepository) FindByWechat(ctx context.Context, openID string) (domain.User, error)
- func (ur *CachedUserRepository) Update(ctx context.Context, u domain.User) error
- type CodeRepository
- type InteractiveRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCodeVerifyTooManyTimes = cache.ErrCodeVerifyTooManyTimes ErrCodeSendTooMany = cache.ErrCodeSendTooMany )
View Source
var ErrUserDuplicate = dao.ErrUserDuplicate
View Source
var ErrUserNotFound = dao.ErrDataNotFound
Functions ¶
This section is empty.
Types ¶
type CachedCodeRepository ¶
type CachedCodeRepository struct {
// contains filtered or unexported fields
}
type CachedReadCntRepository ¶
type CachedReadCntRepository struct {
// contains filtered or unexported fields
}
func (*CachedReadCntRepository) AddCollectionItem ¶
func (*CachedReadCntRepository) Get ¶
func (c *CachedReadCntRepository) Get(ctx context.Context, biz string, bizId int64) (domain.Interactive, error)
func (*CachedReadCntRepository) GetCollection ¶
func (c *CachedReadCntRepository) GetCollection() (domain.Collection, error)
func (*CachedReadCntRepository) IncrReadCnt ¶
type CachedUserRepository ¶
type CachedUserRepository struct {
// contains filtered or unexported fields
}
CachedUserRepository 使用了缓存的 repository 实现
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 string, phone string, inputCode string) (bool, error) }
func NewCachedCodeRepository ¶
func NewCachedCodeRepository(c cache.CodeCache) CodeRepository
type InteractiveRepository ¶
type InteractiveRepository interface { IncrReadCnt(ctx context.Context, biz string, bizId int64) error IncrLike(ctx context.Context, biz string, bizId, uid int64) error DecrLike(ctx context.Context, biz string, bizId, uid int64) error AddCollectionItem(ctx context.Context, biz string, bizId, cid int64, uid int64) error Get(ctx context.Context, biz string, bizId int64) (domain.Interactive, error) Liked(ctx context.Context, biz string, id int64, uid int64) (bool, error) Collected(ctx context.Context, biz string, id int64, uid int64) (bool, error) }
func NewCachedInteractiveRepository ¶
func NewCachedInteractiveRepository(dao dao.InteractiveDAO, cache cache.InteractiveCache, l logger.LoggerV1) InteractiveRepository
type UserRepository ¶
type UserRepository interface { Create(ctx context.Context, u domain.User) error // Update 更新数据,只有非 0 值才会更新 Update(ctx context.Context, u domain.User) error FindByPhone(ctx context.Context, phone string) (domain.User, error) FindByEmail(ctx context.Context, email string) (domain.User, error) FindById(ctx context.Context, id int64) (domain.User, error) FindByWechat(ctx context.Context, openID string) (domain.User, error) }
func NewCachedUserRepository ¶
func NewCachedUserRepository(d dao.UserDAO, c cache.UserCache) UserRepository
NewCachedUserRepository 也说明了 CachedUserRepository 的特性 会从缓存和数据库中去尝试获得
Directories
¶
Path | Synopsis |
---|---|
mocks
Code generated by MockGen.
|
Code generated by MockGen. |
mocks
Code generated by MockGen.
|
Code generated by MockGen. |
redismocks
Code generated by MockGen.
|
Code generated by MockGen. |
article/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
mocks
Code generated by MockGen.
|
Code generated by MockGen. |
Code generated by MockGen.
|
Code generated by MockGen. |
Click to show internal directories.
Click to hide internal directories.