Documentation
¶
Index ¶
- Variables
- func LocalAddrs() ([]string, error)
- type GrpcServer
- func (gs *GrpcServer) Build() (*GrpcServer, error)
- func (gs *GrpcServer) Run() error
- func (gs *GrpcServer) Server() *grpc.Server
- func (gs *GrpcServer) WithHealthcheck(checker healthcheck.IHealthChecker) *GrpcServer
- func (gs *GrpcServer) WithLogger(logger *zap.Logger) *GrpcServer
- func (gs *GrpcServer) WithServerOptions(options ...grpc.ServerOption) *GrpcServer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrServerInit = errors.New("grpcServer init error")
Functions ¶
Types ¶
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
GrpcServer 对象应该全局单例,封装了grpc 注册中心以及服务注册
func New ¶
func New(cfg *config.ServerConfig) *GrpcServer
func (*GrpcServer) Build ¶
func (gs *GrpcServer) Build() (*GrpcServer, error)
func (*GrpcServer) Run ¶
func (gs *GrpcServer) Run() error
func (*GrpcServer) Server ¶
func (gs *GrpcServer) Server() *grpc.Server
func (*GrpcServer) WithHealthcheck ¶
func (gs *GrpcServer) WithHealthcheck(checker healthcheck.IHealthChecker) *GrpcServer
WithHealthcheck 指定healthcheck选项为true, 并且需要指定做业务检查的checker, checker 需要实现 healthcheck.IHealthChecker接口
func (*GrpcServer) WithLogger ¶
func (gs *GrpcServer) WithLogger(logger *zap.Logger) *GrpcServer
func (*GrpcServer) WithServerOptions ¶
func (gs *GrpcServer) WithServerOptions(options ...grpc.ServerOption) *GrpcServer
Click to show internal directories.
Click to hide internal directories.