grpc_tool

package
v0.0.1-dev Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	// contains filtered or unexported fields
}

func NewAutoReconn

func NewAutoReconn(address string, timeout time.Duration) *AutoReConn

func (*AutoReConn) Connect

func (my *AutoReConn) Connect(ctx context.Context) (Connection, error)

func (*AutoReConn) IsValid

func (my *AutoReConn) IsValid() bool

func (*AutoReConn) Process

func (my *AutoReConn) Process(f GetGrpcFunc)

type Connection

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

func NewConnection

func NewConnection(ctx context.Context, 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

Jump to

Keyboard shortcuts

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