biz

package
v0.0.0-...-c2164b1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 4 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheMissVal = "-"

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID          int64
	Uid         int64
	Title       string
	Content     string
	CreatedTime int64
	UpdatedTime int64
	Like        int64
}

type ArticleRepo

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

	// redis
	GetArticleCache(ctx context.Context, id int64) (article string, err error)
	CreateArticleCache(ctx context.Context, id int64, data string) error
	DeleteArticleCache(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) (int64, 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, uid int64) (ps []*Article, err error)

func (*ArticleUsecase) Update

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

Jump to

Keyboard shortcuts

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