Documentation
¶
Index ¶
- Variables
- type Cache
- type CreateGame
- type FindGame
- type FindGameCache
- type Game
- type GameRepo
- type GameUseCase
- func (uc *GameUseCase) Create(ctx context.Context, item *CreateGame) error
- func (uc *GameUseCase) Delete(ctx context.Context, ids ...uint64) error
- func (uc *GameUseCase) Find(ctx context.Context, condition *FindGame) (rp []Game, err error)
- func (uc *GameUseCase) Get(ctx context.Context, id uint64) (rp *Game, err error)
- func (uc *GameUseCase) Update(ctx context.Context, item *UpdateGame) error
- type Transaction
- type UpdateGame
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIdempotentTokenExpired = func(ctx context.Context) error { return i18n.NewError(ctx, constant.IdempotentTokenExpired, reason.ErrorIllegalParameter) } ErrTooManyRequests = func(ctx context.Context) error { return reason.ErrorTooManyRequests(i18n.FromContext(ctx).T(constant.TooManyRequests)) } ErrDataNotChange = func(ctx context.Context, args ...string) error { return i18n.NewError(ctx, constant.DataNotChange, reason.ErrorIllegalParameter, args...) } ErrDuplicateField = func(ctx context.Context, args ...string) error { return i18n.NewError(ctx, constant.DuplicateField, reason.ErrorIllegalParameter, args...) } ErrRecordNotFound = func(ctx context.Context, args ...string) error { return i18n.NewError(ctx, constant.RecordNotFound, reason.ErrorNotFound, args...) } ErrInternal = func(ctx context.Context, args ...string) error { return i18n.NewError(ctx, constant.InternalError, reason.ErrorInternal, args...) } ErrIllegalParameter = func(ctx context.Context, args ...string) error { return i18n.NewError(ctx, constant.IllegalParameter, reason.ErrorIllegalParameter, args...) } )
View Source
var ProviderSet = wire.NewSet( NewGameUseCase, )
ProviderSet is biz providers.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Cache is get redis instance
Cache() redis.UniversalClient
// WithPrefix will add cache key prefix
WithPrefix(prefix string) Cache
// WithRefresh get data from db skip cache and refresh cache
WithRefresh() Cache
// Get is get cache data by key from redis, do write handler if cache is empty
Get(ctx context.Context, action string, write func(context.Context) (string, error)) (string, error)
// Set is set data to redis
Set(ctx context.Context, action, data string, short bool)
// Del delete key
Del(ctx context.Context, action string)
// SetWithExpiration is set data to redis with custom expiration
SetWithExpiration(ctx context.Context, action, data string, seconds int64)
// Flush is clean association cache if handler err=nil
Flush(ctx context.Context, handler func(context.Context) error) error
// FlushByPrefix clean cache by prefix, without prefix equals flush all by default cache prefix
FlushByPrefix(ctx context.Context, prefix ...string) (err error)
}
type CreateGame ¶ added in v1.1.2
type FindGameCache ¶ added in v1.0.2
type GameUseCase ¶ added in v1.0.2
type GameUseCase struct {
// contains filtered or unexported fields
}
func NewGameUseCase ¶ added in v1.0.2
func NewGameUseCase(c *conf.Bootstrap, repo GameRepo, tx Transaction, cache Cache) *GameUseCase
func (*GameUseCase) Create ¶ added in v1.0.2
func (uc *GameUseCase) Create(ctx context.Context, item *CreateGame) error
func (*GameUseCase) Delete ¶ added in v1.0.2
func (uc *GameUseCase) Delete(ctx context.Context, ids ...uint64) error
func (*GameUseCase) Update ¶ added in v1.0.2
func (uc *GameUseCase) Update(ctx context.Context, item *UpdateGame) error
type Transaction ¶
type UpdateGame ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.