Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Persist ¶
Persist will store the key-value pair in provided context. Either wrapping it in a persistent context that supports multiple value storage, or digging through the context stack for an existing persistent context into which it will store the key-value pair. This allows storing and accessing context values across multiple layers of a callstack, both forwards and backwards.
Types ¶
type PersistCtx ¶
type PersistCtx struct { // embedded base ctx. context.Context // contains filtered or unexported fields }
persistctx wraps a base context.Context in order to provide persistent key-value storage across both directions of a callstack.
func Get ¶
func Get(ctx context.Context) *PersistCtx
Get will wrap the provided context in a PersistCtx, or return an existing copy if found in the context stack.
func (*PersistCtx) Set ¶
func (ctx *PersistCtx) Set(key any, value any)
Set will safely set the key-value pair in context "map".
func (*PersistCtx) Value ¶
func (ctx *PersistCtx) Value(key any) any
Value implements context.Context's Value().