biz

package
v0.0.0-...-367fef7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 6 Imported by: 0

README

Biz

业务组装层

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID        int64
	Title     string
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
	Like      int64
}

type ArticleRepo

type ArticleRepo interface {
	ListArticle(ctx context.Context) ([]*Article, error)
	GetArticle(ctx context.Context, id int64) (*Article, error)
	CreateArticle(ctx context.Context, article *Article) error
	UpdateArticle(ctx context.Context, id int64, article *Article) error
	DeleteArticle(ctx context.Context, id int64) error

	GetArticleLike(ctx context.Context, id int64) (rv int64, err error)
	IncArticleLike(ctx context.Context, id int64) error
}

type ArticleUsecase

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

func NewArticleUsecase

func NewArticleUsecase(repo ArticleRepo, logger *zap.Logger) *ArticleUsecase

func (*ArticleUsecase) Create

func (uc *ArticleUsecase) Create(ctx context.Context, article *Article) error

func (*ArticleUsecase) Delete

func (uc *ArticleUsecase) Delete(ctx context.Context, id int64) error

func (*ArticleUsecase) Get

func (uc *ArticleUsecase) Get(ctx context.Context, id int64) (p *Article, err error)

func (*ArticleUsecase) List

func (uc *ArticleUsecase) List(ctx context.Context) (ps []*Article, err error)

func (*ArticleUsecase) Update

func (uc *ArticleUsecase) Update(ctx context.Context, id int64, article *Article) error

type CommentRepo

type CommentRepo interface {
	ListArticleComments(ctx context.Context, articleID int64) ([]*v1.Comment, error)
	CreateComment(ctx context.Context, articleID int64, comment *v1.Comment) error
	DeleteArticleComment(ctx context.Context, articleID, commentID int64) error
}

type CommentUsecase

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

func NewCommentUsecase

func NewCommentUsecase(repo CommentRepo, logger *zap.Logger) *CommentUsecase

func (*CommentUsecase) Create

func (uc *CommentUsecase) Create(ctx context.Context, articleID int64, comment *v1.Comment) error

func (*CommentUsecase) ListComments

func (uc *CommentUsecase) ListComments(ctx context.Context, articleID int64) ([]*v1.Comment, error)

Jump to

Keyboard shortcuts

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