grpc_tool

package
v0.0.5 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: 2

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