Versions in this module Expand all Collapse all v1 v1.1.0 Jul 10, 2026 Changes in this version + func CatalogFrom(ctx context.Context) *i18n.Catalog + func LocaleFrom(ctx context.Context) string + func WithLocale(ctx context.Context, locale string, cat *i18n.Catalog) context.Context + type BackpressureOption func(*backpressureCfg) + func OnBackpressureOverload(fn func(route string)) BackpressureOption + func OnInFlightChange(fn func(n int)) BackpressureOption + type CSRFPolicy struct + CookieName string + FieldName string + HeaderName string + SameSite string + Secure bool type Middleware + func Backpressure(maxInFlight int, overload config.Overload, opts ...BackpressureOption) Middleware + func CSRFProtect(p CSRFPolicy) Middleware + func Locale(cat *i18n.Catalog) Middleware + func SecurityChain(sec config.Security) []Middleware v1.0.0 Jul 6, 2026 Changes in this version + const IdempotencyHeader + func ActorFrom(ctx context.Context) (authz.Actor, bool) + func BindAndValidate[T any](r *http.Request, v *validation.Validator, maxBytes int64) (T, error) + func Chain(h http.Handler, mws ...Middleware) http.Handler + func DecodeJSON[T any](r *http.Request, maxBytes int64) (T, error) + func ETagFrom(version int) string + func KeyByActor(r *http.Request) string + func KeyByIP(r *http.Request) string + func ParseFilters(r *http.Request, allow filtering.Allowlist) (filtering.Set, error) + func ParsePagination(r *http.Request, def pagination.Defaults) (pagination.Request, error) + func ParseResourceID(r *http.Request, param string) (uuid.UUID, error) + func ParseSort(r *http.Request, allow filtering.SortAllowlist) (filtering.Sort, error) + func RequestHash(r *http.Request, canonical []byte) string + func RequestIDFrom(ctx context.Context) string + func RequireIfMatch(r *http.Request) (int, error) + func WithActor(ctx context.Context, a authz.Actor) context.Context + func WithIdempotency(ctx context.Context, w http.ResponseWriter, r *http.Request, ...) + func WithRequestID(ctx context.Context, id string) context.Context + func WriteError(ctx context.Context, w http.ResponseWriter, err error) + func WriteJSON[T any](w http.ResponseWriter, status int, body T) + type APIResponse struct + Data T + Meta *Meta + func OKWithMeta[T any](data T, meta *Meta) APIResponse[T] + func OK[T any](data T) APIResponse[T] + type AuditMeta struct + CreatedAt time.Time + CreatedBy uuid.UUID + UpdatedAt *time.Time + Version int + func AuditMetaFrom(a model.Auditable, version int) *AuditMeta + type Authenticator interface + Authenticate func(r *http.Request) (authz.Actor, error) + func Composite(auths ...Authenticator) Authenticator + type CORSPolicy struct + AllowCredentials bool + AllowedHeaders []string + AllowedMethods []string + AllowedOrigins []string + ExposedHeaders []string + MaxAge time.Duration + type DenyAllAuthenticator struct + func (DenyAllAuthenticator) Authenticate(*http.Request) (authz.Actor, error) + type Health struct + func NewHealth(fingerprint string) *Health + func (h *Health) Liveness() http.HandlerFunc + func (h *Health) Readiness() http.HandlerFunc + func (h *Health) Register(name string, c HealthCheck) *Health + type HealthCheck func(context.Context) error + type IdempotencyConfig struct + ActorScope string + Store database.IdemStore + TTL time.Duration + type Meta struct + Audit *AuditMeta + RequestID string + type Middleware func(http.Handler) http.Handler + func BodyLimit(maxBytes int64) Middleware + func CORS(p CORSPolicy) Middleware + func RateLimit(limiter RateLimiter, keyFn func(*http.Request) string, opts ...RateLimitOption) Middleware + func Recover(logger *slog.Logger) Middleware + func RequestID() Middleware + func SecureHeaders(opts ...SecureHeadersOption) Middleware + func Timeout(d time.Duration) Middleware + type Operation func(ctx context.Context, db database.TenantDB) (status int, body any, err error) + type ProblemError struct + Code string + Detail string + Errors []errors.FieldError + Instance string + RequestID string + Status int + Title string + Type string + type RateLimitOption func(*rateLimitCfg) + func OnRateLimitDrop(fn func(route string)) RateLimitOption + type RateLimiter interface + Allow func(key string) (allowed bool, retryAfter time.Duration) + type Route struct + Handler http.HandlerFunc + Meta RouteMeta + Method string + Pattern string + type RouteMeta struct + Idempotent bool + Permission string + Public bool + Scope ScopeExtractor + Sensitive bool + type Router struct + func NewRouter() *Router + func (r *Router) Err() error + func (r *Router) Handle(method, pattern string, meta RouteMeta, h http.HandlerFunc) + func (r *Router) Permissions() []string + func (r *Router) Routes() []Route + func (r *Router) SecureHandler(auth Authenticator, eval authz.Evaluator, txm database.TxManager) *http.ServeMux + type ScopeExtractor func(r *http.Request) (authz.Target, error) + type SecureHeadersOption func(*secureHeadersConfig) + func WithCSP(value string) SecureHeadersOption + func WithHSTS(value string) SecureHeadersOption + func WithoutHSTS() SecureHeadersOption + type TokenBucket struct + func NewTokenBucket(ratePerSec float64, burst int) *TokenBucket + func NewTokenBucketWithClock(ratePerSec float64, burst int, now func() time.Time) *TokenBucket + func (tb *TokenBucket) Allow(key string) (bool, time.Duration)