reqctx

package
v1.26.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestDataStoreKey requestDataStoreKeyType

Functions

func NewRequestContext

func NewRequestContext(parentCtx context.Context, profDesc string) (_ context.Context, finished func())

Types

type ContextData

type ContextData map[string]any

func (ContextData) GetData

func (ds ContextData) GetData() ContextData

func (ContextData) MergeFrom

func (ds ContextData) MergeFrom(other ContextData) ContextData

type ContextDataProvider

type ContextDataProvider interface {
	GetData() ContextData
}

type RequestContext

type RequestContext interface {
	context.Context
	RequestDataStore
}

func FromContext

func FromContext(ctx context.Context) RequestContext

func NewRequestContextForTest

func NewRequestContextForTest(parentCtx context.Context) RequestContext

NewRequestContextForTest creates a new RequestContext for testing purposes It doesn't add the context to the process manager, nor do cleanup

type RequestDataStore

type RequestDataStore interface {
	GetData() ContextData
	SetContextValue(k, v any)
	GetContextValue(key any) any
	AddCleanUp(f func())
	AddCloser(c io.Closer)
}

RequestDataStore is a short-lived context-related object that is used to store request-specific data.

func GetRequestDataStore

func GetRequestDataStore(ctx context.Context) RequestDataStore

Jump to

Keyboard shortcuts

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