middleware

package
v0.0.0-...-cb42e1a Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LogKeyTrace  string = "trace"
	LogKeyMethod string = "method"
	LogKeyURL    string = "url"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateCorrelationIdFunc

type GenerateCorrelationIdFunc func() string

type HeaderInfoMiddleware

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

HeaderInfoMiddleware reads headers from request and add their value in request context

func NewHeaderInfoMiddleware

func NewHeaderInfoMiddleware(next http.Handler, headers map[string]interface{}) *HeaderInfoMiddleware

NewHeaderInfoMiddleware builds a new HeaderInfoMiddleware

func (*HeaderInfoMiddleware) ServeHTTP

func (m *HeaderInfoMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

HeaderInfoMiddleware reads headers from request and add their value in request context

type LoggerInjectorMiddleware

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

LoggerInjectorMiddleware injects the logger in the request then calls the next handler

func NewLoggerInjectorMiddleware

func NewLoggerInjectorMiddleware(logger *slog.Logger, next http.Handler) *LoggerInjectorMiddleware

NewLoggerInjectorMiddleware builds a new LoggerInjectorMiddleware

func NewLoggerInjectorMiddlewareWithTracing

func NewLoggerInjectorMiddlewareWithTracing(logger *slog.Logger, next http.Handler, generateCorrelationIdFunc GenerateCorrelationIdFunc) *LoggerInjectorMiddleware

NewLoggerInjectorMiddleware builds a new LoggerInjectorMiddleware

func (*LoggerInjectorMiddleware) ServeHTTP

ServeHTTP injects the logger in the request then calls the next handler

type RequestLoggerMiddleware

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

RequestLoggerMiddleware logs the request method and path then calls the next handler

func NewRequestLoggerMiddleware

func NewRequestLoggerMiddleware(next http.Handler) *RequestLoggerMiddleware

NewRequestLoggerMiddleware builds a new LogRequestMiddleware. LogLevel is Info.

func NewRequestLoggerMiddlewareWithLogLevel

func NewRequestLoggerMiddlewareWithLogLevel(next http.Handler, logLevel slog.Level) *RequestLoggerMiddleware

NewRequestLoggerMiddlewareWithLogLevel builds a new LogRequestMiddleware configuring the log level

func (*RequestLoggerMiddleware) ServeHTTP

ServeHTTP logs the request method and path then calls the next handler

type UserSignupMiddleware

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

func NewUserSignupMiddleware

func NewUserSignupMiddleware(next http.Handler, cache cache.Cache) *UserSignupMiddleware

func (*UserSignupMiddleware) ServeHTTP

func (m *UserSignupMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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