biz

package
v0.0.0-...-86dbffa Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT, MIT Imports: 7 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewGameUseCase)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Game

type Game struct {
	Id          int64
	Name        string
	Description string
	Count       int64
}

type GameRepo

type GameRepo interface {
	// db
	// read from db if cache miss
	GetGame(ctx context.Context, id int64) (*Game, error)
	ListGame(ctx context.Context, pageNum, pageSize int64) ([]*Game, error)
	CreateGame(ctx context.Context, c *Game) (*Game, error)
	UpdateGame(ctx context.Context, c *Game) (*Game, error)

	// redis
	// read from Redis. if cache miss, read from db and create backfill job
	CacheGetGame(ctx context.Context, id int64) (*Game, error)
	CacheListGame(ctx context.Context, pageNum int64, pageSize int64) ([]*Game, error)
	CacheCreateGame(ctx context.Context, c *Game) (*Game, error)
	CacheUpdateGame(ctx context.Context, c *Game) (*Game, error)

	// kafka
	// Create, update & backfill will be handled by catalog-job
	KafkaCreateGame(ctx context.Context, c *Game) (*Game, error)
	KafkaUpdateGame(ctx context.Context, c *Game) (*Game, error)
	KafkaBackfillGame(ctx context.Context, Id int64) error
	KafkaBackfillListGame(ctx context.Context, pageNum int64, pageSize int64) error
}

type GameUseCase

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

func NewGameUseCase

func NewGameUseCase(repo GameRepo, logger log.Logger) *GameUseCase

func (*GameUseCase) Create

func (uc *GameUseCase) Create(ctx context.Context, u *Game) (*Game, error)

func (*GameUseCase) Get

func (uc *GameUseCase) Get(ctx context.Context, id int64) (*Game, error)

func (*GameUseCase) List

func (uc *GameUseCase) List(ctx context.Context, pageNum, pageSize int64) ([]*Game, error)

func (*GameUseCase) Update

func (uc *GameUseCase) Update(ctx context.Context, u *Game) (*Game, error)

type Image

type Image struct {
	URL string
}

Jump to

Keyboard shortcuts

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