Documentation ¶
Index ¶
- Variables
- type CachedCodeRepository
- type CachedRankingRepository
- type CachedReadCntRepository
- func (c *CachedReadCntRepository) AddCollectionItem(ctx context.Context, biz string, bizId, cid, uid int64) error
- func (c *CachedReadCntRepository) AddRecord(ctx context.Context, aid int64, uid int64) error
- func (c *CachedReadCntRepository) BatchIncrReadCnt(ctx context.Context, bizs []string, bizId []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)
- func (c *CachedReadCntRepository) UpdateCnt(intr *dao.Interactive)
- func (c *CachedReadCntRepository) UpdateCntV1(intr dao.Interactive) dao.Interactive
- 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 InteractiveRepository
- type JobRepository
- type PreemptCronJobRepository
- func (p *PreemptCronJobRepository) Preempt(ctx context.Context, refreshInterval time.Duration) (domain.Job, error)
- func (p *PreemptCronJobRepository) Release(ctx context.Context, id int64) error
- func (p *PreemptCronJobRepository) Stop(ctx context.Context, id int64) error
- func (p *PreemptCronJobRepository) UpdateNextTime(ctx context.Context, id int64, next time.Time) error
- func (p *PreemptCronJobRepository) UpdateUtime(ctx context.Context, id int64) error
- type RankingRepository
- 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 CachedRankingRepository ¶
type CachedRankingRepository struct {
// contains filtered or unexported fields
}
func (*CachedRankingRepository) ReplaceTopN ¶
type CachedReadCntRepository ¶
type CachedReadCntRepository struct {
// contains filtered or unexported fields
}
func (*CachedReadCntRepository) AddCollectionItem ¶
func (*CachedReadCntRepository) BatchIncrReadCnt ¶
func (c *CachedReadCntRepository) BatchIncrReadCnt(ctx context.Context, bizs []string, bizId []int64) error
BatchIncrReadCnt bizs 和 ids 的长度必须相等
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 ¶
func (*CachedReadCntRepository) UpdateCnt ¶
func (c *CachedReadCntRepository) UpdateCnt(intr *dao.Interactive)
UpdateCnt 这不是好的实践
func (*CachedReadCntRepository) UpdateCntV1 ¶
func (c *CachedReadCntRepository) UpdateCntV1(intr dao.Interactive) dao.Interactive
UpdateCntV1 凑合的实践
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 InteractiveRepository ¶
type InteractiveRepository interface { IncrReadCnt(ctx context.Context, biz string, bizId int64) error BatchIncrReadCnt(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) AddRecord(ctx context.Context, aid int64, uid int64) error }
func NewCachedInteractiveRepository ¶
func NewCachedInteractiveRepository(dao dao.InteractiveDAO, cache cache.InteractiveCache, l logger.LoggerV1) InteractiveRepository
type JobRepository ¶
type JobRepository interface { Preempt(ctx context.Context, refreshInterval time.Duration) (domain.Job, error) Release(ctx context.Context, id int64) error UpdateUtime(ctx context.Context, id int64) error UpdateNextTime(ctx context.Context, id int64, next time.Time) error Stop(ctx context.Context, id int64) error }
type PreemptCronJobRepository ¶
type PreemptCronJobRepository struct {
// contains filtered or unexported fields
}
func (*PreemptCronJobRepository) Release ¶
func (p *PreemptCronJobRepository) Release(ctx context.Context, id int64) error
func (*PreemptCronJobRepository) Stop ¶
func (p *PreemptCronJobRepository) Stop(ctx context.Context, id int64) error
func (*PreemptCronJobRepository) UpdateNextTime ¶
func (*PreemptCronJobRepository) UpdateUtime ¶
func (p *PreemptCronJobRepository) UpdateUtime(ctx context.Context, id int64) error
type RankingRepository ¶
type RankingRepository interface { ReplaceTopN(ctx context.Context, arts []domain.Article) error GetTopN(ctx context.Context) ([]domain.Article, error) }
func NewCachedRankingRepository ¶
func NewCachedRankingRepository( redis *cache.RankingRedisCache, local *cache.RankingLocalCache, ) RankingRepository
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.