biz

package
v0.0.0-...-abca24b Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 6 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotFound is user not found.
	ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Data

type Data struct {
	Meta  Meta
	Items interface{}
}

type Greeter

type Greeter struct {
	Hello string
}

Greeter is a Greeter model.

type GreeterRepo

type GreeterRepo interface {
	Save(context.Context, *Greeter) (*Greeter, error)
	Update(context.Context, *Greeter) (*Greeter, error)
	FindByID(context.Context, int64) (*Greeter, error)
	ListByHello(context.Context, string) ([]*Greeter, error)
	ListAll(context.Context) ([]*Greeter, error)
}

GreeterRepo is a Greater repo.

type GreeterUsecase

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

GreeterUsecase is a Greeter usecase.

func NewGreeterUsecase

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

NewGreeterUsecase new a Greeter usecase.

func (*GreeterUsecase) CreateGreeter

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

CreateGreeter creates a Greeter, and returns the new Greeter.

type House

type House struct {
	ID    int32  `db:"id"`
	Title string `db:"title"`
	Price string `db:"price"`
	Cover string `db:"cover"`
}

type HouseRepo

type HouseRepo interface {
	PaginatedListHouse(ctx context.Context, req *Request) ([]*House, error)
}

type HouseUsecase

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

func NewHouseUsecase

func NewHouseUsecase(repo HouseRepo, logger log.Logger) *HouseUsecase

func (*HouseUsecase) PaginatedListHouse

func (uc *HouseUsecase) PaginatedListHouse(ctx context.Context, req *v1.PagintatedListHouseRequest) ([]*House, error)

type Meta

type Meta struct {
	Total       int64
	CurrentPage int64
	PerPage     int64
	HasNext     int64
}

type Request

type Request struct {
	Type     int32
	Page     int32
	PageSize int32
}

type User

type User struct {
	UserId   int64  `db:"user_id"`
	Username string `db:"realname"`
	Mobile   string `db:"mobile"`
}

type UserRepo

type UserRepo interface {
	GetUserByUserId(ctx context.Context, req *UserRequest) (*User, error)
	GetUserByMobile(ctx context.Context, req *UserRequest) (*User, error)
	GetPaginatedUsers(ctx context.Context, req *UserRequest) ([]*User, error)
	CountUsers(ctx context.Context, req *UserRequest) (int64, error)
}

type UserRequest

type UserRequest struct {
	UserId   int64
	Page     int64
	PageSize int64
	Mobile   string
}

type UserUsecase

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

func NewUserUsecase

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

func (*UserUsecase) GetPaginatedUsers

func (uc *UserUsecase) GetPaginatedUsers(ctx context.Context, req *v1.ListUserRequest) (*Data, error)

func (*UserUsecase) GetUserByMobile

func (uc *UserUsecase) GetUserByMobile(ctx context.Context, req *v1.GetUserRequest) (*User, error)

func (*UserUsecase) GetUserByUserId

func (uc *UserUsecase) GetUserByUserId(ctx context.Context, req *v1.GetUserRequest) (*User, error)

Jump to

Keyboard shortcuts

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