metadata

package
v0.0.2-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package metadata provides utilities for attaching and retrieving metadata from Go contexts. It offers both simple key-value storage and a specialized context implementation that supports string-keyed metadata for efficient data passing between function calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetaFrom

func MetaFrom(ctx context.Context) map[string]any

MetaFrom extracts metadata from the given context. Returns nil if no metadata is found or if the stored value is not a valid metadata map.

func WithMeta

func WithMeta(ctx context.Context, m map[string]any) context.Context

WithMeta returns a new context with the provided metadata map attached. The metadata can be retrieved later using MetaFrom.

func WithValues

func WithValues(ctx context.Context, data map[string]any) context.Context

WithValues creates a new context with additional string-keyed metadata. The metadata is accessible through the Value method using string keys. Returns the original context if no data is provided.

Types

This section is empty.

Jump to

Keyboard shortcuts

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