Help us shape the future of Go! Take the 2026 Go Developer Survey

reqctx

package
v3.1.43 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 5 Imported by: 0

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

Source Files

  • datastore.go

Jump to

Keyboard shortcuts

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