biz

package
v0.0.0-...-6fd52d9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 14 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 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 IPodRepository

type IPodRepository interface {
	//初始化表
	InitTable() error
	//根据ID查找数据
	FindPodByID(int64) (*model.Pod, error)
	//创建一条 Pod 数据
	CreatePod(*model.Pod) (int64, error)
	//根据ID删除一条 Pod 数据
	DeletePodByID(int64) error
	//修改一条数据
	UpdatePod(*model.Pod) error
	//查找Pod所有数据
	FindAll() ([]model.Pod, error)
}

type PodUsecase

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

PodUsecase is a Greeter usecase.

func NewPodUsecase

func NewPodUsecase(repo IPodRepository, K8sClientSet *kubernetes.Clientset, logger log.Logger) *PodUsecase

NewPodUsecase 创建 PodRepository

func (*PodUsecase) AddPod

func (pu *PodUsecase) AddPod(pod2 *model.Pod) (int64, error)

添加Pod

func (*PodUsecase) CreatePod

func (pu *PodUsecase) CreatePod(ctx context.Context, pod *model.Pod) (int64, error)

CreatePod creates a pod, and returns the new pod.

func (*PodUsecase) CreateToK8s

func (pu *PodUsecase) CreateToK8s(ctx context.Context, podInfo *pb.PodInfo) (err error)

创建pod到k8s中

func (*PodUsecase) DeleteFromK8s

func (pu *PodUsecase) DeleteFromK8s(ctx context.Context, pod *model.Pod) (err error)

删除pod

func (*PodUsecase) DeletePod

func (pu *PodUsecase) DeletePod(podID int64) error

删除

func (*PodUsecase) FindAllPod

func (pu *PodUsecase) FindAllPod() ([]model.Pod, error)

查找所有

func (*PodUsecase) FindPodByID

func (pu *PodUsecase) FindPodByID(podID int64) (*model.Pod, error)

单个查找

func (*PodUsecase) SetDeployment

func (pu *PodUsecase) SetDeployment(podInfo *pb.PodInfo)

func (*PodUsecase) UpdatePod

func (pu *PodUsecase) UpdatePod(pod2 *model.Pod) error

更新

func (*PodUsecase) UpdateToK8s

func (pu *PodUsecase) UpdateToK8s(ctx context.Context, podInfo *pb.PodInfo) (err error)

更新deployment,pod

Jump to

Keyboard shortcuts

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