contracts/grpc.go

33 lines
499 B
Go
Raw Normal View History

2023-05-16 14:45:14 +08:00
package contracts
2023-06-05 13:37:32 +08:00
import (
2023-06-05 16:52:03 +08:00
"github.com/samber/do"
2023-06-05 13:37:32 +08:00
"google.golang.org/grpc"
)
2023-06-05 16:52:03 +08:00
type GRpcServcer interface {
2023-05-16 14:45:14 +08:00
Start() error
Stop() error
Restart() error
}
2023-06-05 13:37:32 +08:00
2023-06-05 16:52:03 +08:00
type GRpc interface {
Controller
// 获取 gRPC 服务的描述信息
GetGRpcServiceDesc() *grpc.ServiceDesc
}
type GRpcBase struct {
Controller
}
func (GRpcBase) GetGRpcServiceDesc() *grpc.ServiceDesc {
return nil
2023-06-05 13:37:32 +08:00
}
2023-06-05 16:52:03 +08:00
func NewJGRpcBase(container *do.Injector) GRpc {
return &GRpcBase{
Controller: &BaseController{container},
}
2023-06-05 13:37:32 +08:00
}