Documentation ¶
Overview ¶
Package hooks implements a gRPC middleware that executes service and method hooks.
Register a hook for all methods in a service with filter /package.service or a specific method with filter /package.service/method. Registering a hook overwrites existing hooks with the same filter and name.
Hooks are executed in order of registration. Service hooks are executed before service method hooks.
Index ¶
- type Hooks
- func (h *Hooks) RegisterStreamHook(filter, name string, f StreamHandlerMiddleware)
- func (h *Hooks) RegisterUnaryHook(filter, name string, f UnaryHandlerMiddleware)
- func (h *Hooks) StreamServerInterceptor() grpc.StreamServerInterceptor
- func (h *Hooks) UnaryServerInterceptor() grpc.UnaryServerInterceptor
- func (h *Hooks) UnregisterStreamHook(filter, name string) bool
- func (h *Hooks) UnregisterUnaryHook(filter, name string) bool
- type StreamHandlerMiddleware
- type UnaryHandlerMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hooks ¶ added in v3.18.2
type Hooks struct {
// contains filtered or unexported fields
}
func (*Hooks) RegisterStreamHook ¶ added in v3.18.2
func (h *Hooks) RegisterStreamHook(filter, name string, f StreamHandlerMiddleware)
func (*Hooks) RegisterUnaryHook ¶ added in v3.18.2
func (h *Hooks) RegisterUnaryHook(filter, name string, f UnaryHandlerMiddleware)
func (*Hooks) StreamServerInterceptor ¶ added in v3.18.2
func (h *Hooks) StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new stream server interceptor that executes registered hooks.
func (*Hooks) UnaryServerInterceptor ¶ added in v3.18.2
func (h *Hooks) UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor that executes registered hooks.
func (*Hooks) UnregisterStreamHook ¶ added in v3.18.2
func (*Hooks) UnregisterUnaryHook ¶ added in v3.18.2
type StreamHandlerMiddleware ¶
type StreamHandlerMiddleware func(grpc.StreamHandler) grpc.StreamHandler
StreamHandlerMiddleware wraps grpc.StreamHandler.
type UnaryHandlerMiddleware ¶
type UnaryHandlerMiddleware func(grpc.UnaryHandler) grpc.UnaryHandler
UnaryHandlerMiddleware wraps grpc.UnaryHandler.