typemeta

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 3 Imported by: 0

README

go-typemeta

stores per-runtime-type metadata in a concurrency-safe manner optimized for minimum memory overhead (e.g. not hashmaps all over the place!)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta atomic.Pointer[meta]

Meta is a concurrency safe singly-linked list holding key-value pairs, optimized for safety and low memory usage. Under the hood it acts similarly to how standard library context values are stored. You should not regularly rely on fetching / setting values in this, instead caching values yourself.

func Generic

func Generic[T any]() *Meta

Generic fetches Meta for generic type.

func Load

func Load(rt reflect.Type) *Meta

Load fetches Meta for reflected type.

func Of

func Of(a any) *Meta

Of fetches Meta for given type.

func (*Meta) Get

func (m *Meta) Get(key any) any

Get fetches value stored under key.

func (*Meta) Set

func (m *Meta) Set(key any, value any)

Set stores given value under key.

Jump to

Keyboard shortcuts

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