grpc

package
v0.0.0-...-97deb8b Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 20 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, opts ...util.Mod[protojson.MarshalOptions]) ([]byte, error)

func MarshalYAML

func MarshalYAML[T proto.Message](in T, opts ...util.Mod[protojson.MarshalOptions]) ([]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, opts ...util.Mod[protojson.UnmarshalOptions]) (T, error)

Types

type GRPC

type GRPC[T proto.Message] struct {
	Object T
}

func NewGRPC

func NewGRPC[T proto.Message](in T) GRPC[T]

func (GRPC[T]) MarshalJSON

func (g GRPC[T]) MarshalJSON(opts ...util.Mod[protojson.MarshalOptions]) ([]byte, error)

func (*GRPC[T]) UnmarshalJSON

func (g *GRPC[T]) UnmarshalJSON(data []byte, opts ...util.Mod[protojson.UnmarshalOptions]) error

type HTTPResponse

type HTTPResponse[T proto.Message] interface {
	WithCode(codes ...int) HTTPResponse[T]
	Get() (T, error)
}

func Get

func Post

func Post[IN, T proto.Message](ctx context.Context, client operatorHTTP.HTTPClient, in IN, url string, mods ...util.Mod[goHttp.Request]) HTTPResponse[T]

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