biz

package
v0.0.0-...-c4f823d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT, MIT Imports: 4 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
}

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) (p *Article, err error)
	UpdateArticle(ctx context.Context, id int64, article *Article) (p *Article, err error)
	DeleteArticle(ctx context.Context, id int64) error
}

type ArticleUsecase

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

func NewArticleUsecase

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

func (*ArticleUsecase) Create

func (uc *ArticleUsecase) Create(ctx context.Context, article *Article) (p *Article, err 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) (p *Article, err error)

type Comment

type Comment struct {
	ID        int64
	UserId    int64
	ArticleId int64
	Content   string
	CreatedAt time.Time
}

type CommentRepo

type CommentRepo interface {
	AddComment(ctx context.Context, comment *Comment) (*Comment, error)
	GetComments(ctx context.Context, articleId int64) ([]*Comment, error)
	DeleteComment(ctx context.Context, id int64) error
}

type CommentUsecase

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

func NewCommentUsecase

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

func (*CommentUsecase) AddComment

func (uc *CommentUsecase) AddComment(ctx context.Context, comment *Comment) (p *Comment, err error)

func (*CommentUsecase) DeleteComment

func (uc *CommentUsecase) DeleteComment(ctx context.Context, id int64) error

func (*CommentUsecase) GetComments

func (uc *CommentUsecase) GetComments(ctx context.Context, articleId int64) ([]*Comment, error)

Jump to

Keyboard shortcuts

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