Documentation
¶
Overview ¶
Domain service
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrArticleNotFound = repository.ErrArticleNotFound ErrPublish = errors.New("still failed to publish article after retries") )
View Source
var ( ErrCodeSendTooMany = repository.ErrCodeSendTooMany ErrCodeVerifyTooMany = repository.ErrCodeVerifyTooMany )
View Source
var ( ErrDuplicatedUser = repository.ErrDuplicatedUser ErrInvalidUserOrPassword = errors.New("wrong email or password") ErrInvalidUserID = errors.New("unknown userID") )
Functions ¶
func NewArticleServiceV1 ¶
func NewArticleServiceV1( l logger.Logger, readerRepo repository.ArticleReaderRepository, authorRepo repository.ArticleAuthorRepository, ) *articleService
Types ¶
type ArticleService ¶
type ArticleService interface { Save(ctx context.Context, article domain.Article) (int64, error) Publish(ctx context.Context, article domain.Article) (int64, error) Withdraw(ctx context.Context, userID int64, articleID int64) error GetByAuthor(ctx context.Context, uid int64, offset int, limit int) ([]domain.Article, error) GetByID(ctx context.Context, id int64) (domain.Article, error) GetPubByID(ctx context.Context, id int64, uid int64) (domain.Article, error) BatchGetPubByIDs(ctx context.Context, ids []int64) ([]domain.Article, error) ListPub(ctx context.Context, start time.Time, offset, limit int) ([]domain.Article, error) }
func NewArticleService ¶
func NewArticleService( repo repository.ArticleRepository, producer article.Producer, ) ArticleService
type BatchRankingService ¶
type BatchRankingService struct {
// contains filtered or unexported fields
}
type CodeService ¶
type CodeService interface { Send(ctx context.Context, biz string, phone string, tpl *template.Template) error Verify(ctx context.Context, biz string, phone string, inputCode string) (bool, error) }
func NewCodeService ¶
func NewCodeService(repo repository.CodeRepository, sms sms.Service) CodeService
type JobService ¶
type JobService interface { Preempt(ctx context.Context) (domain.Job, error) ResetNextTime(ctx context.Context, job domain.Job) error }
func NewCronJobService ¶
func NewCronJobService( l logger.Logger, repo repository.JobRepository, ) JobService
type RankingService ¶
type RankingService interface { TopN(ctx context.Context) error GetTopN(ctx context.Context) ([]domain.Article, error) }
func NewBatchRankingService ¶
func NewBatchRankingService( intrSvc intrv1.InteractiveServiceClient, artSvc ArticleService, repo repository.RankingRepository, ) RankingService
type UserService ¶
type UserService interface { SignUp(ctx context.Context, u domain.User) (domain.User, error) Login(ctx context.Context, email string, password string) (domain.User, error) EditProfile(ctx context.Context, user *domain.User) error GetProfile(ctx context.Context, userID int64) (domain.User, error) FindOrCreate(ctx context.Context, phone string) (domain.User, error) FindOrCreateByGitea(ctx context.Context, info domain.GiteaInfo) (domain.User, error) }
func NewUserService ¶
func NewUserService(repo repository.UserRepository) UserService
Click to show internal directories.
Click to hide internal directories.