contracts/grpc.go
2023-06-06 10:14:16 +08:00

33 lines
499 B
Go

package contracts
import (
"github.com/samber/do"
"google.golang.org/grpc"
)
type GRpcService interface {
Start() error
Stop() error
Restart() error
}
type GRpc interface {
Controller
// 获取 gRPC 服务的描述信息
GetGRpcServiceDesc() *grpc.ServiceDesc
}
type GRpcBase struct {
Controller
}
func (GRpcBase) GetGRpcServiceDesc() *grpc.ServiceDesc {
return nil
}
func NewJGRpcBase(container *do.Injector) GRpc {
return &GRpcBase{
Controller: &BaseController{container},
}
}