reflect

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(reg Registry) grpc.StreamServerInterceptor

StreamServerInterceptor returns an interceptor that injects server and method info into the stream context

func UnaryServerInterceptor

func UnaryServerInterceptor(reg Registry) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns an interceptor that injects server and method info into the request context

func WithMethodInfo

func WithMethodInfo(ctx context.Context, info MethodInfo) context.Context

WithMethodInfo injects method info into context

Types

type MethodInfo

type MethodInfo interface {
	Service() pref.ServiceDescriptor
	Method() pref.MethodDescriptor
}

MethodInfo provides service and method descriptors

func GetMethodInfo

func GetMethodInfo(ctx context.Context) (MethodInfo, bool)

GetMethodInfo extracts method info from context

type Registry

type Registry interface {
	Load(srv *grpc.Server) error
	LoadFile(file string) error
	GetMethodInfo(name string) (MethodInfo, bool)
	MustGetMethodInfo(name string) MethodInfo
}

Registry provides efficient access to method and service descriptors for grpc servers

func NewRegistry

func NewRegistry() Registry

NewRegistry creates a new method info registry

Jump to

Keyboard shortcuts

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