interceptor

package
v0.0.0-...-4fbe3ce Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

* user define interceptor

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostHandler

func PostHandler(ctx context.Context, req interface{}, resp interface{}, err error)

Default AfterHandlerFunc Log request and response information if error not nil

func RequestInfoExtract

func RequestInfoExtract(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo) context.Context

Default BeforeHandlerFunc Extract request information from metadata then set them to context

func UnaryRequestInfoInterceptor

func UnaryRequestInfoInterceptor(handlerFunc BeforeHandlerFunc, afterHandlerFunc AfterHandlerFunc) grpc.UnaryServerInterceptor

UnaryRequestInfoInterceptor returns a unary interceptor to add before/post handler for request. handlerFunc: if nil use default RequestInfoExtract afterHandlerFunc: if nil use default PostHandler

Types

type AfterHandlerFunc

type AfterHandlerFunc func(ctx context.Context, req interface{}, resp interface{}, err error)

type BeforeHandlerFunc

type BeforeHandlerFunc func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo) context.Context

Jump to

Keyboard shortcuts

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