metadata

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: BSD-3-Clause Imports: 2 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](md Data, key string) (T, error)

Get gets metadata value of given type. returns error if not present or item is a different type.

Types

type Data

type Data map[string]any

Data is metadata as a map of named any elements with generic support for type-safe Get and nil-safe Set.

func (*Data) Copy

func (md *Data) Copy(src Data)

Copy does a shallow copy of metadata from source. Any pointer-based values will still point to the same underlying data as the source, but the two maps remain distinct. It uses maps.Copy.

func (*Data) Set

func (md *Data) Set(key string, value any)

Set sets key to given value, ensuring that the map is created if not previously.

Jump to

Keyboard shortcuts

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