Documentation
¶
Overview ¶
Package querylimits provides stable core query-parameter guardrail middleware.
Use New with Options when handlers need bounded query parameter counts, key lengths, value lengths, and pagination limit values before application parsing. Middleware and Handler expose the same guardrail for ports.Middleware wiring or direct net/http usage.
Invalid query shapes fail with Problem Details 400 responses and do not reach the wrapped handler. The package does not parse business filters or database queries; use queryparams for typed collection-query parsing after these size and limit checks pass.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorWriter ¶
type ErrorWriter func(http.ResponseWriter, int, httpx.Problem)
ErrorWriter allows overriding how validation errors are written.
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware enforces query parameter limits.
func New ¶
func New(opts Options) (*Middleware, error)
New constructs a query limits middleware with safe defaults.
func (*Middleware) Handler ¶
func (m *Middleware) Handler(next http.Handler) http.Handler
Handler wraps the next handler with query guardrails.
func (*Middleware) Middleware ¶
func (m *Middleware) Middleware() func(http.Handler) http.Handler
Middleware implements ports.Middleware via Handler adapter.