grpc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 19 Imported by: ? 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 Err

func Err(err error, comments ...string) error

func NewGrpcClientFx

func NewGrpcClientFx[T ClientOptions, M GrpcClient2]() fx.Option

func NewGrpcServerFx

func NewGrpcServerFx[T ServerOptions]() fx.Option

func NewInsecureClient

func NewInsecureClient(grpcUrl string) (*grpc.ClientConn, error)

func NewRequestLogger

func NewRequestLogger(logr *slog.Logger, comment string) *logger

func ParseErr

func ParseErr(err error) *errors.Error

Types

type Client

type Client interface {
	grpc.ClientConnInterface
	Close() error
}

func NewGrpcClient

func NewGrpcClient(serverAddr string) (Client, error)

func NewGrpcClientV2

func NewGrpcClientV2(serverAddr string, opts GrpcConnectOpts) (Client, error)

type ClientOptions

type ClientOptions interface {
	GetGRPCServerURL() string
}

type GrpcClient2

type GrpcClient2 interface {
	~*grpc.ClientConn
}

type GrpcConnectOpts

type GrpcConnectOpts struct {
	TLSConnect bool
	Logger     *slog.Logger

	ReconnectCheckInterval *time.Duration
}

type Server

type Server interface {
	grpc.ServiceRegistrar
	Listen(addr string) error
	Stop()
}

func NewGrpcServer

func NewGrpcServer(opts ServerOpts) (Server, error)

type ServerOptions

type ServerOptions interface {
	GetGRPCPort() uint16
}

type ServerOpts

type ServerOpts struct {
	ShowLogs bool
	Logger   *slog.Logger
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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