Documentation ¶
Index ¶
- Constants
- func AccessLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func CORSMiddleware(next http.Handler) http.Handler
- func ChainMiddleware(h http.Handler, m ...Middleware) http.Handler
- func ErrorLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func Recovery(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func RequestIDClientInterceptor() grpc.UnaryClientInterceptor
- func RequestIDServerInterceptor() grpc.UnaryServerInterceptor
- func StreamContextTimeout() grpc.StreamClientInterceptor
- func UnaryContextTimeout() grpc.UnaryClientInterceptor
- type Middleware
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 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 ¶
Click to show internal directories.
Click to hide internal directories.