timeout

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package timeout provides timeout utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	Timeout time.Duration
}

Middleware applies a per-request context timeout without writing responses.

func New

func New(opts Options) (*Middleware, error)

New constructs a timeout middleware with the given duration.

func (*Middleware) Handler

func (m *Middleware) Handler(next http.Handler) http.Handler

Handler wraps the next handler with a context timeout.

func (*Middleware) Middleware

func (m *Middleware) Middleware() func(http.Handler) http.Handler

Middleware implements ports.Middleware via Handler adapter.

type Options

type Options struct {
	Timeout time.Duration
}

Options configures the timeout middleware.

Jump to

Keyboard shortcuts

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