grpc_tool

package
v0.2.3-dev Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 19 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunGrpcServ

func RunGrpcServ(ctx context.Context, cfg *GrpcConfig) error

Types

type AutoReConn

type AutoReConn struct {
	Connection

	Ready     chan bool
	Done      chan bool
	Reconnect chan bool
	Error     chan error
	// contains filtered or unexported fields
}

func NewAutoReconn

func NewAutoReconn(address string) *AutoReConn

func (*AutoReConn) Connect

func (my *AutoReConn) Connect() (Connection, error)

func (*AutoReConn) IsValid

func (my *AutoReConn) IsValid() bool

func (*AutoReConn) Process

func (my *AutoReConn) Process(f GetGrpcFunc)

func (*AutoReConn) SetLog

func (my *AutoReConn) SetLog(l log.Logger)

type AutoReConnInter

type AutoReConnInter interface {
	SetLog(l log.Logger)
}

type Connection

type Connection interface {
	grpc.ClientConnInterface
	Close() error
	IsValid() bool
	WaitUntilReady() bool
}

func NewConnection

func NewConnection(address string) (Connection, error)

type GetGrpcFunc

type GetGrpcFunc func(myGrpc Connection) error

type GrpcConfig

type GrpcConfig struct {
	Port           int  `env:"GRPC_PORT"`
	ReflectService bool `env:"GRPC_REFLECT"`

	Logger Log
	// contains filtered or unexported fields
}

func GetConfigFromEnv

func GetConfigFromEnv() (*GrpcConfig, error)

func (*GrpcConfig) SetInterceptors

func (c *GrpcConfig) SetInterceptors(i ...interceptor.Interceptor)

func (*GrpcConfig) SetRegisterServiceFunc

func (c *GrpcConfig) SetRegisterServiceFunc(f func(grpcServer *grpc.Server))

type Log

type Log interface {
	Infof(format string, a ...any)
	Fatalf(format string, a ...any)
}

Directories

Path Synopsis
health
pb

Jump to

Keyboard shortcuts

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