context

package
v2.13.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 3 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

This section is empty.

Functions

This section is empty.

Types

type ContextCancel

type ContextCancel = Pair[context.CancelFunc, context.Context]

ContextCancel represents a pair of a cancel function and a context. It is used in operations that create new contexts with cancellation capabilities.

The first element is the CancelFunc that should be called to release resources. The second element is the new Context that was created.

func NopCancel

func NopCancel(ctx context.Context) ContextCancel

type Kleisli

type Kleisli[A, B any] = func(A) Reader[B]

func WithValue

func WithValue[A, K any](key K) Kleisli[A, context.Context]

type Pair

type Pair[A, B any] = pair.Pair[A, B]

Pair represents a tuple of two values of types A and B. It is used to group two related values together.

type Reader

type Reader[A any] = func(context.Context) A

func AskValue added in v2.3.138

func AskValue[V, K any](key K) Reader[common.Option[V]]

AskValue reads the value stored under key and asserts it to V. It returns None if the key is absent or the stored value is not a V.

func WithValueNopCancel added in v2.3.138

func WithValueNopCancel[K, V any](key K, value V) Reader[ContextCancel]

WithValueNopCancel derives a child context carrying key → value, paired with a no-op cancel function, suitable for Local-style combinators.

Jump to

Keyboard shortcuts

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