You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/examples/i18n/internal/biz/greeter.go

32 lines
683 B

package biz
import (
"context"
"github.com/go-kratos/kratos/v2/log"
)
type Greeter struct {
Hello string
}
type GreeterRepo interface {
CreateGreeter(context.Context, *Greeter) error
UpdateGreeter(context.Context, *Greeter) error
}
type GreeterUsecase struct {
repo GreeterRepo
log *log.Helper
}
func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase {
return &GreeterUsecase{repo: repo, log: log.NewHelper(logger)}
}
func (uc *GreeterUsecase) Create(ctx context.Context, g *Greeter) error {
return uc.repo.CreateGreeter(ctx, g)
}
func (uc *GreeterUsecase) Update(ctx context.Context, g *Greeter) error {
return uc.repo.UpdateGreeter(ctx, g)
}