middleware

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestIdKey ctxKeyRequestId = struct{}{}

Functions

func Append added in v0.8.5

func Append(m1 []Middleware, m2 ...Middleware) http.Handler

func AppendHandler added in v0.8.5

func AppendHandler(m []Middleware, h http.Handler) http.Handler

func GetRequestId

func GetRequestId(ctx context.Context) string

func RequestId

func RequestId(next http.Handler) http.Handler

Types

type LogReq added in v0.8.5

type LogReq struct {
	// contains filtered or unexported fields
}

func (*LogReq) WithCustomLevel added in v0.8.5

func (self *LogReq) WithCustomLevel(url string, level logger.Level) *LogReq

type LoggerOption added in v0.8.5

type LoggerOption func(l *LogReq)

func WithCompletedInfo

func WithCompletedInfo() LoggerOption

func WithCustomLevel added in v0.8.5

func WithCustomLevel(url string, level logger.Level) LoggerOption

type Middleware

type Middleware func(next http.Handler) http.Handler

func JsonRequestResponder

func JsonRequestResponder[T1 any, T2 any](log logger.Logger,
	h func(req *T1) (T2, error),
) Middleware

func JsonResponder

func JsonResponder[T any](log logger.Logger, h func() (T, error)) Middleware

func PrometheusMetrics added in v0.8.5

func PrometheusMetrics(begin *prometheus.CounterVec,
	finished *prometheus.HistogramVec,
) Middleware

func RequestLogger

func RequestLogger(log logger.Logger, opts ...LoggerOption) Middleware

Jump to

Keyboard shortcuts

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