middleware

package
v0.0.0-...-19dc864 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(jwtSecret string, l logger.Interface) gin.HandlerFunc

AuthMiddleware creates a middleware for JWT authentication

func Logger

func Logger(l logger.Interface) gin.HandlerFunc

func ProfileFunction

func ProfileFunction(c *gin.Context, functionName, packageName string, fn func() error) error

ProfileFunction is a helper function to profile any function from gin context

func ProfileFunctionWithContext

func ProfileFunctionWithContext(c *gin.Context, functionName, packageName string, fn func(context.Context) error) error

ProfileFunctionWithContext is a helper function to profile any function with context

func ProfilingContextMiddleware

func ProfilingContextMiddleware(profiler *profiling.Profiler) gin.HandlerFunc

ProfilingContextMiddleware adds profiling context to gin context

func ProfilingMiddleware

func ProfilingMiddleware(profiler *profiling.Profiler, logger zerolog.Logger) gin.HandlerFunc

ProfilingMiddleware creates middleware for automatic function profiling

func Recovery

func Recovery(l logger.Interface) func(c *fiber.Ctx) error

func TimeoutMiddleware

func TimeoutMiddleware(config ...TimeoutConfig) gin.HandlerFunc

TimeoutMiddleware creates a middleware that enforces request timeouts

func TimeoutWithHandler

func TimeoutWithHandler(timeout time.Duration, handler gin.HandlerFunc) gin.HandlerFunc

TimeoutWithHandler creates a timeout middleware with custom handler

Types

type TimeoutConfig

type TimeoutConfig struct {
	Timeout time.Duration
	// Optional: Custom timeout response
	TimeoutResponse gin.H
	// Optional: Skip timeout for specific paths
	SkipPaths []string
}

TimeoutConfig represents the configuration for timeout middleware

func DefaultTimeoutConfig

func DefaultTimeoutConfig() TimeoutConfig

DefaultTimeoutConfig returns a default timeout configuration

Jump to

Keyboard shortcuts

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