requestidbridge

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package requestidbridge integrates explicitly with request ID middleware such as http-middleware/requestid without importing hidden context keys.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLookup reports a missing lookup or malformed returned value.
	ErrInvalidLookup = errors.New("request ID bridge: invalid lookup")
	// ErrUntrusted reports a source that was not explicitly trusted.
	ErrUntrusted = errors.New("request ID bridge: source is not trusted")
	// ErrMissing reports an absent middleware request ID.
	ErrMissing = errors.New("request ID bridge: request ID is missing")
	// ErrOverwrite reports an attempt to replace an existing request ID.
	ErrOverwrite = errors.New("request ID bridge: request ID overwrite")
)

Functions

func Adopt

func Adopt(ctx context.Context, values correlation.Values, lookup Lookup, options Options) (context.Context, correlation.Values, error)

Adopt validates a middleware request ID, refuses overwrite, and returns a derived context containing the complete correlation Values.

Types

type Lookup

type Lookup func(context.Context) (string, bool)

Lookup matches a bound call to requestid.FromContext. The application keeps ownership of which middleware package and Kind it selects.

type Options

type Options struct {
	Policy  correlation.Policy
	Trusted bool
}

Options require explicit trust for the middleware-owned context value.

Jump to

Keyboard shortcuts

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