gserver

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServerInit = errors.New("grpcServer init error")

Functions

func LocalAddrs

func LocalAddrs() ([]string, error)

LocalAddrs 获取本机所有非回环地址

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

Jump to

Keyboard shortcuts

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