middleware

package
v0.0.0-...-e08e33e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestID = "x-request-id"
)

Variables

This section is empty.

Functions

func AccessLog

func AccessLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func CORSMiddleware

func CORSMiddleware(next http.Handler) http.Handler

func ChainMiddleware

func ChainMiddleware(h http.Handler, m ...Middleware) http.Handler

func ErrorLog

func ErrorLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

普通错误记录的日志拦截器

func Recovery

func Recovery(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

异常捕抓拦截器

func RequestIDClientInterceptor

func RequestIDClientInterceptor() grpc.UnaryClientInterceptor

func RequestIDServerInterceptor

func RequestIDServerInterceptor() grpc.UnaryServerInterceptor

func StreamContextTimeout

func StreamContextTimeout() grpc.StreamClientInterceptor

func UnaryContextTimeout

func UnaryContextTimeout() grpc.UnaryClientInterceptor

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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