grpc

package module
v1.2.120 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrpcOrDefaultHandler

func GrpcOrDefaultHandler(grpcServer *grpc.Server, defaultHandler http.Handler) http.Handler

GrpcOrDefaultHandler returns a http.Handler that delegates to grpcServer on incoming gRPC connections or defaultHandler otherwise. Copied from cockroachdb.

Types

type UnaryHandlerDecorator added in v1.2.120

type UnaryHandlerDecorator interface {
	WrapUnaryHandler(rt grpc.UnaryHandler) grpc.UnaryHandler
}

UnaryHandlerDecorator is an interface representing the ability to decorate or wrap a grpc.UnaryHandler.

type UnaryHandlerDecoratorFunc added in v1.2.120

type UnaryHandlerDecoratorFunc func(next grpc.UnaryHandler) grpc.UnaryHandler

The UnaryHandlerDecoratorFunc type is an adapter to allow the use of ordinary functions as gRPC handler decorators. If f is a function with the appropriate signature, UnaryHandlerDecoratorFunc(f) is a UnaryHandlerDecorator that calls f.

func (UnaryHandlerDecoratorFunc) WrapUnaryHandler added in v1.2.120

func (f UnaryHandlerDecoratorFunc) WrapUnaryHandler(next grpc.UnaryHandler) grpc.UnaryHandler

WrapUnaryHandler calls f(rt).

type UnaryHandlerDecorators added in v1.2.120

type UnaryHandlerDecorators []UnaryHandlerDecorator

UnaryHandlerDecorators defines a UnaryHandlerDecorator slice.

func (UnaryHandlerDecorators) WrapUnaryHandler added in v1.2.120

func (chain UnaryHandlerDecorators) WrapUnaryHandler(next grpc.UnaryHandler) grpc.UnaryHandler

type UnaryHandlerGeneric added in v1.2.120

type UnaryHandlerGeneric[REQ any, RESP any] func(ctx context.Context, req REQ) (resp RESP, err error)

UnaryHandlerGeneric is a generic version of grpc.UnaryHandler as gRPC-Gateway does not support gRPC interceptors when call gRPC's service handler in process. See: https://github.com/grpc-ecosystem/grpc-gateway/issues/1043

func NewUnaryHandlerGeneric added in v1.2.120

func NewUnaryHandlerGeneric[REQ any, RESP any](handler grpc.UnaryHandler) UnaryHandlerGeneric[REQ, RESP]

func WithUnaryHandlerDecorators added in v1.2.120

func WithUnaryHandlerDecorators[REQ any, RESP any](h UnaryHandlerGeneric[REQ, RESP], decorators ...UnaryHandlerDecorator) UnaryHandlerGeneric[REQ, RESP]

func (UnaryHandlerGeneric[REQ, RESP]) UnaryHandler added in v1.2.120

func (f UnaryHandlerGeneric[REQ, RESP]) UnaryHandler() grpc.UnaryHandler

type UnaryServerInterceptorGeneric added in v1.2.120

type UnaryServerInterceptorGeneric[REQ any, RESP any] func(ctx context.Context, req REQ, info *grpc.UnaryServerInfo, handler UnaryHandlerGeneric[REQ, RESP]) (resp RESP, err error)

UnaryServerInterceptorGeneric is a generic version of grpc.UnaryServerInterceptor as gRPC-Gateway does not support gRPC interceptors when call gRPC's service handler in process. See: https://github.com/grpc-ecosystem/grpc-gateway/issues/1043

func NewUnaryServerInterceptorGeneric added in v1.2.120

func NewUnaryServerInterceptorGeneric[REQ any, RESP any](interceptor grpc.UnaryServerInterceptor) UnaryServerInterceptorGeneric[REQ, RESP]

func (UnaryServerInterceptorGeneric[REQ, RESP]) UnaryServerInterceptor added in v1.2.120

func (f UnaryServerInterceptorGeneric[REQ, RESP]) UnaryServerInterceptor() grpc.UnaryServerInterceptor

Directories

Path Synopsis
Package grpclog defines slog-based logging for grpc.
Package grpclog defines slog-based logging for grpc.
logruslogger Module
internal

Jump to

Keyboard shortcuts

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