ginmiddleware

package
v0.0.0-...-a2bc238 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultResponseInterceptor

func SetDefaultResponseInterceptor(r Recorder)

SetDefaultResponseInterceptor for http handler response

Types

type Middleware

type Middleware func(next gin.HandlerFunc) gin.HandlerFunc

Middleware is a chainable preprocessor for Endpoint

func RecoverWithTrace

func RecoverWithTrace(name string) Middleware

RecoverWithTrace middleware is a RecoverMiddleware wraps with a trace handler

func Trace

func Trace(name string) Middleware

Trace will create a trace handler middleware

func (Middleware) HandlerFunc

func (m Middleware) HandlerFunc(next gin.HandlerFunc) gin.HandlerFunc

HandlerFunc will return the HandlerFunc of the middleware

type Recorder

type Recorder interface {
	Record(ctx context.Context, statistics Statistics)
}

Recorder for http handler response status & body size

func NewLogRecorder

func NewLogRecorder() Recorder

NewLogRecorder for log purpose

func NewMultiRecorder

func NewMultiRecorder(recorders ...Recorder) Recorder

NewMultiRecorder will chain MultiRecorder

type Statistics

type Statistics struct {
	Status   int
	BodySize int
}

Statistics for http handler response

Jump to

Keyboard shortcuts

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