grpc

package
v0.0.0-...-6f318c5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationGRPCHeader = "adb-authorization"

Variables

This section is empty.

Functions

func ClientTLS

func ClientTLS(config *tls.Config) []grpc.DialOption

func GRPCAnyCastAs

func GRPCAnyCastAs[T proto.Message](in *anypb.Any, v T) error

func Marshal

func Marshal[T proto.Message](in T) ([]byte, error)

func MarshalYAML

func MarshalYAML[T proto.Message](in T) ([]byte, error)

func NewGRPCClient

func NewGRPCClient[T any](ctx context.Context, in func(cc grpc.ClientConnInterface) T, addr string, opts ...grpc.DialOption) (T, io.Closer, error)

func NewGRPCConn

func NewGRPCConn(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func NewOptionalTLSGRPCClient

func NewOptionalTLSGRPCClient[T any](ctx context.Context, in func(cc grpc.ClientConnInterface) T, addr string, tls *tls.Config, opts ...grpc.DialOption) (T, io.Closer, error)

func NewOptionalTLSGRPCConn

func NewOptionalTLSGRPCConn(ctx context.Context, addr string, tls *tls.Config, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func Recv

func Recv[T any](recv RecvInterface[T], parser func(T) error) error

func Send

func Send[T, O any](send SendInterface[T, O], batch func() (T, error)) (O, error)

func TokenAuthInterceptors

func TokenAuthInterceptors(token string) []grpc.DialOption

func Unmarshal

func Unmarshal[T proto.Message](data []byte) (T, error)

Types

type RecvInterface

type RecvInterface[T any] interface {
	Recv() (T, error)
	grpc.ClientStream
}

type SendInterface

type SendInterface[T, O any] interface {
	Send(T) error
	CloseAndRecv() (O, error)
	grpc.ClientStream
}

Jump to

Keyboard shortcuts

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