ctxutil

package
v0.0.0-...-e237f2d Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Singleton

func Singleton[T any](ctx context.Context) T

Return the value "T" attached to the context.

If there is no value attached, the zero value is returned.

func WithSingleton

func WithSingleton[T any](ctx context.Context, value T) context.Context

Attaches value to the context using the type "T" as key.

This actually creates a singleton instance of "T" in the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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