trace

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID retrieves the request ID from the context.

Types

type ContextKey

type ContextKey string

ContextKey is a custom type for context keys to avoid collisions.

const RequestIDKey ContextKey = "request_id"

type RequestID

type RequestID struct{}

func WithRequestID

func WithRequestID() *RequestID

func (*RequestID) Middleware

func (r *RequestID) Middleware(next http.Handler) http.Handler

Middleware generates a unique request ID for each incoming HTTP request, stores it in the context, and sets it in the response headers.

Jump to

Keyboard shortcuts

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