biz

package
v0.0.0-...-1f7b599 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 4 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewUserUsecase)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Greeter

type Greeter struct {
	Hello string
}

type GreeterRepo

type GreeterRepo interface {
	CreateGreeter(context.Context, *Greeter) error
	UpdateGreeter(context.Context, *Greeter) error
}

type GreeterUsecase

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

func NewGreeterUsecase

func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase

func (*GreeterUsecase) Create

func (uc *GreeterUsecase) Create(ctx context.Context, g *Greeter) error

func (*GreeterUsecase) Update

func (uc *GreeterUsecase) Update(ctx context.Context, g *Greeter) error

type User

type User struct {
	ID          string
	Username    string
	Email       string
	DisplayName string
	IsBlocked   bool
	Ctime       time.Time
	Utime       time.Time
	Like        int64
}

type UserRepo

type UserRepo interface {
	// db
	ListUser(ctx context.Context) ([]*User, error)
	GetUser(ctx context.Context, userID string) (*User, error)
	CreateUser(ctx context.Context, user *User) error
	UpdateUser(ctx context.Context, userID string, user *User) error
	DeleteUser(ctx context.Context, userID string) error

	// redis
	GetUserLike(ctx context.Context, userID string) (rv int64, err error)
	IncUserLike(ctx context.Context, userID string) error
}

type UserUsecase

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

func NewUserUsecase

func NewUserUsecase(repo UserRepo, logger log.Logger) *UserUsecase

func (*UserUsecase) Create

func (uc *UserUsecase) Create(ctx context.Context, user *User) error

func (*UserUsecase) Delete

func (uc *UserUsecase) Delete(ctx context.Context, userID string) error

func (*UserUsecase) Get

func (uc *UserUsecase) Get(ctx context.Context, userID string) (p *User, err error)

func (*UserUsecase) List

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

func (*UserUsecase) Update

func (uc *UserUsecase) Update(ctx context.Context, userID string, user *User) error

Jump to

Keyboard shortcuts

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