Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicateEmail = repository.ErrUserDuplicate ErrInvalidUserOrPassword = errors.New("用户不存在或者密码不对") )
定义业务处理的异常
View Source
var (
ErrTooManyCodeSend = cache.ErrNextCodeTooSoon
)
Functions ¶
This section is empty.
Types ¶
type ArticleService ¶
type ArticleService interface { GetById(context.Context, int64) (domain.Article, error) // Save upsert语义 Save(context.Context, domain.Article) (int64, error) List(ctx context.Context, authorId int64, limit int, offset int) ([]domain.Article, error) // 操作的表不一样 Publish(context.Context, domain.Article) (int64, error) WithDraw(ctx context.Context, userId int64, artId int64) error GetPubById(ctx context.Context, artId int64) (domain.PublishedArticle, error) ListPub(ctx context.Context, start time.Time, offset int, batchSize int) ([]domain.PublishedArticle, error) }
func NewArticleService ¶
func NewArticleService(repo repository.ArticleRepository, producer article.Producer) ArticleService
type BatchRankingService ¶
type BatchRankingService struct {
// contains filtered or unexported fields
}
func NewBatchRankingService ¶
func NewBatchRankingService(n int, batchSize int, artSvc ArticleService, usrActSvc UserActivityService, scoreFn func(readCnt int64, utime time.Time) float64, repo repository.RankingRepository) *BatchRankingService
func (*BatchRankingService) RankTopN ¶
func (b *BatchRankingService) RankTopN(ctx context.Context) error
func (*BatchRankingService) TopN ¶
func (b *BatchRankingService) TopN(ctx context.Context) ([]domain.PublishedArticle, error)
type CodeService ¶
type CodeService interface { Send(ctx context.Context, biz string, phone string) error Verify(ctx context.Context, biz string, phone string, inputCode string) (bool, error) }
func NewSMSCodeService ¶
func NewSMSCodeService(repo *repository.CodeRepository, decorator *prometheus.Decorator) CodeService
type PriorityQueue ¶
type PriorityQueue []*Score
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type RankingService ¶
type SMSCodeService ¶
type SMSCodeService struct {
// contains filtered or unexported fields
}
type UserActivityService ¶
type UserActivityService interface { IncrRead(ctx context.Context, biz string, bizId int64) error GetReadByIds(ctx context.Context, biz string, ids []int64) ([]domain.UserActivity, error) }
func NewUserActivityService ¶
func NewUserActivityService(repo repository.UserActivityRepository) UserActivityService
type UserService ¶
type UserService interface { FindById(ctx context.Context, uid int64) (domain.User, error) Signup(context.Context, domain.User) error FindOrCreate(ctx context.Context, phone string) (domain.User, error) Login(ctx context.Context, email, password string) (domain.User, error) UpdateNonPII(ctx context.Context, user domain.User) error }
UserService 用户相关服务
func NewUserService ¶
func NewUserService(repo repository.UserRepository) UserService
Click to show internal directories.
Click to hide internal directories.