repository

package
v0.0.0-...-7efebb4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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 AsyncSmsRepository interface {
	Add(ctx context.Context, s domain.AsyncSms) error
	PreemptiveGetSms(ctx context.Context) (domain.AsyncSms, error)
	ReportScheduleResult(ctx context.Context, smsId int64, success bool) error
}

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 (repo *CacheUserActivityRepository) BatchIncrRead(ctx context.Context, bizs []string, bizIds []int64) error

func (*CacheUserActivityRepository) GetReadByIds

func (repo *CacheUserActivityRepository) GetReadByIds(ctx context.Context, biz string, ids []int64) ([]domain.UserActivity, error)

func (*CacheUserActivityRepository) IncrRead

func (repo *CacheUserActivityRepository) IncrRead(ctx context.Context, biz string, bizId int64) error

type CacheUserRepository

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

func (*CacheUserRepository) Create

func (repo *CacheUserRepository) Create(ctx context.Context, user domain.User) error

func (*CacheUserRepository) FindByEmail

func (repo *CacheUserRepository) FindByEmail(ctx context.Context, email string) (domain.User, error)

func (*CacheUserRepository) FindById

func (repo *CacheUserRepository) FindById(ctx context.Context, uid int64) (domain.User, error)

func (*CacheUserRepository) FindByPhone

func (repo *CacheUserRepository) FindByPhone(ctx context.Context, phone string) (domain.User, error)

func (*CacheUserRepository) Update

func (repo *CacheUserRepository) Update(ctx context.Context, user domain.User) error

type CachedArticleRepository

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

func (*CachedArticleRepository) GetByAuthor

func (repo *CachedArticleRepository) GetByAuthor(ctx context.Context, authorId int64, limit int, offset int) ([]domain.Article, error)

func (*CachedArticleRepository) GetById

func (repo *CachedArticleRepository) GetById(ctx context.Context, id int64) (domain.Article, error)

func (*CachedArticleRepository) GetPubById

func (*CachedArticleRepository) Insert

func (repo *CachedArticleRepository) Insert(ctx context.Context, article domain.Article) (int64, error)

func (*CachedArticleRepository) ListPub

func (repo *CachedArticleRepository) ListPub(ctx context.Context, start time.Time,
	offset int, batchSize int) ([]domain.PublishedArticle, error)

func (*CachedArticleRepository) Sync

func (repo *CachedArticleRepository) Sync(ctx context.Context, article domain.Article) (int64, 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

func (*CodeRepository) Set

func (repo *CodeRepository) Set(ctx context.Context, biz, phone, code string) error

func (*CodeRepository) Verify

func (repo *CodeRepository) Verify(ctx context.Context, biz, phone, code string) (bool, error)

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)
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL