Documentation
¶
Index ¶
- Variables
- func CircuitBreakerModule(priority int) fx.Option
- func ErrorLoggerModule(priority int) fx.Option
- func HTTPBulkheadModule(priority int) fx.Option
- func LoggerModule(priority int) fx.Option
- func NewGinModule() fx.Option
- func ProblemModule(priority int) fx.Option
- func RateLimitModule(priority int) fx.Option
- func RecoveryModule(priority int) fx.Option
- func TimeoutModule(priority int) fx.Option
- type Middleware
Constants ¶
This section is empty.
Variables ¶
var ErrCircuitBreakerOpen = errors.New("circuit breaker is open")
Functions ¶
func CircuitBreakerModule ¶
CircuitBreakerModule adds circuit breaker middleware to the application.
func ErrorLoggerModule ¶
ErrorLoggerModule provides error logger middleware.
func HTTPBulkheadModule ¶
HTTPBulkheadModule adds HTTP bulkhead middleware to the application.
func LoggerModule ¶
LoggerModule provides logger middleware.
func NewGinModule ¶
NewGinModule provides all Gin middleware modules. Middleware execution order (by priority, lower = earlier):
10 - Recovery - catches panics (must be first) 20 - Logger - logs all requests 30 - ErrorLogger - logs errors from ALL middleware and handlers 40 - Problem - converts errors to RFC 7807 (must wrap all error sources) 50 - Timeout - kills hanging requests 60 - CircuitBreaker - protects against cascading failures 70 - RateLimit - limits requests/second 80 - HTTPBulkhead - limits concurrent requests
Note: OpenAPI validation is NOT included here - use ogen-generated servers which provide built-in validation with better type safety.
func ProblemModule ¶
ProblemModule provides problem details middleware.
func RateLimitModule ¶
RateLimitModule adds rate limiting middleware to the application.
func RecoveryModule ¶
RecoveryModule provides recovery middleware.
func TimeoutModule ¶
TimeoutModule adds timeout middleware to the application.
Types ¶
type Middleware ¶
type Middleware struct {
Priority int
Handler gin.HandlerFunc
}
Middleware represents a Gin middleware with priority.