Documentation
¶
Index ¶
- Variables
- type ArticleRepository
- type AsyncSmsRepository
- type CacheRankingRepository
- type CacheUserActivityRepository
- func (repo *CacheUserActivityRepository) BatchIncrRead(ctx context.Context, bizs []string, bizIds []int64) error
- func (repo *CacheUserActivityRepository) GetReadByIds(ctx context.Context, biz string, ids []int64) ([]domain.UserActivity, error)
- func (repo *CacheUserActivityRepository) IncrRead(ctx context.Context, biz string, bizId int64) error
- type CacheUserRepository
- func (repo *CacheUserRepository) Create(ctx context.Context, user domain.User) error
- func (repo *CacheUserRepository) FindByEmail(ctx context.Context, email string) (domain.User, error)
- func (repo *CacheUserRepository) FindById(ctx context.Context, uid int64) (domain.User, error)
- func (repo *CacheUserRepository) FindByPhone(ctx context.Context, phone string) (domain.User, error)
- func (repo *CacheUserRepository) Update(ctx context.Context, user domain.User) error
- type CachedArticleRepository
- func (repo *CachedArticleRepository) GetByAuthor(ctx context.Context, authorId int64, limit int, offset int) ([]domain.Article, error)
- func (repo *CachedArticleRepository) GetById(ctx context.Context, id int64) (domain.Article, error)
- func (repo *CachedArticleRepository) GetPubById(ctx context.Context, id int64) (domain.PublishedArticle, error)
- func (repo *CachedArticleRepository) Insert(ctx context.Context, article domain.Article) (int64, error)
- func (repo *CachedArticleRepository) ListPub(ctx context.Context, start time.Time, offset int, batchSize int) ([]domain.PublishedArticle, error)
- func (repo *CachedArticleRepository) Sync(ctx context.Context, article domain.Article) (int64, error)
- func (repo *CachedArticleRepository) SyncStatus(ctx context.Context, userId int64, artId int64, status domain.ArticleStatus) error
- type CodeRepository
- type RankingRepository
- type UserActivityRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserDuplicate = dao.ErrUserDuplicate ErrRecordNotFound = dao.ErrRecordNotFound )
View Source
var (
ErrIllegalOffsetOrLimit = errors.New("非法偏移量")
)
View Source
var ErrSmsNotFound = errors.New("没有找到相应短信")
View Source
var (
ErrVerifyTooManyTimes = cache.ErrVerifyTooManyTimes
)
Functions ¶
This section is empty.
Types ¶
type ArticleRepository ¶
type ArticleRepository interface { GetById(context.Context, int64) (domain.Article, error) Insert(context.Context, domain.Article) (int64, error) GetByAuthor(context.Context, int64, int, int) ([]domain.Article, error) Sync(context.Context, domain.Article) (int64, error) SyncStatus(context.Context, int64, int64, domain.ArticleStatus) error GetPubById(context.Context, int64) (domain.PublishedArticle, error) ListPub(ctx context.Context, start time.Time, offset int, batchSize int) ([]domain.PublishedArticle, error) }
func NewArticleRepository ¶
func NewArticleRepository(dao dao.ArticleDAO, cache cache.ArticleCache) ArticleRepository
type AsyncSmsRepository ¶
type CacheRankingRepository ¶
type CacheRankingRepository struct {
// contains filtered or unexported fields
}
func NewCacheRankingRepository ¶
func NewCacheRankingRepository(cache cache.RankingCache) *CacheRankingRepository
func (*CacheRankingRepository) ReplaceTopN ¶
func (c *CacheRankingRepository) ReplaceTopN(ctx context.Context, arts []domain.PublishedArticle) error
type CacheUserActivityRepository ¶
type CacheUserActivityRepository struct {
// contains filtered or unexported fields
}
func (*CacheUserActivityRepository) BatchIncrRead ¶
func (*CacheUserActivityRepository) GetReadByIds ¶
func (repo *CacheUserActivityRepository) GetReadByIds(ctx context.Context, biz string, ids []int64) ([]domain.UserActivity, error)
type CacheUserRepository ¶
type CacheUserRepository struct {
// contains filtered or unexported fields
}
func (*CacheUserRepository) FindByEmail ¶
func (*CacheUserRepository) FindByPhone ¶
type CachedArticleRepository ¶
type CachedArticleRepository struct {
// contains filtered or unexported fields
}
func (*CachedArticleRepository) GetByAuthor ¶
func (*CachedArticleRepository) GetPubById ¶
func (repo *CachedArticleRepository) GetPubById(ctx context.Context, id int64) (domain.PublishedArticle, error)
func (*CachedArticleRepository) ListPub ¶
func (repo *CachedArticleRepository) ListPub(ctx context.Context, start time.Time, offset int, batchSize int) ([]domain.PublishedArticle, error)
func (*CachedArticleRepository) SyncStatus ¶
func (repo *CachedArticleRepository) SyncStatus(ctx context.Context, userId int64, artId int64, status domain.ArticleStatus) error
type CodeRepository ¶
type CodeRepository struct {
// contains filtered or unexported fields
}
func NewCodeRepository ¶
func NewCodeRepository(cache cache.CodeCache) *CodeRepository
type RankingRepository ¶
type RankingRepository interface {
ReplaceTopN(ctx context.Context, arts []domain.PublishedArticle) error
}
type UserActivityRepository ¶
type UserActivityRepository interface { IncrRead(ctx context.Context, biz string, bizId int64) error BatchIncrRead(ctx context.Context, bizs []string, bizIds []int64) error GetReadByIds(ctx context.Context, biz string, ids []int64) ([]domain.UserActivity, error) }
func NewCacheUserActivityRepository ¶
func NewCacheUserActivityRepository(cache cache.UserActivityCache, dao dao.UserActivityDAO) UserActivityRepository
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) }
func NewCacheUserRepository ¶
func NewCacheUserRepository(dao dao.UserDAO, userCache cache.UserCache) UserRepository
Source Files
¶
Click to show internal directories.
Click to hide internal directories.