Documentation
¶
Overview ¶
Package kv provides fluent operations on Go maps (key-value collections).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Keys ¶
func Keys[K comparable, V any](m map[K]V) base.Mapper[K]
Keys extracts the keys of m as a Mapper for further transformation. Shortcut for From(m).Keys().
func Map ¶
func Map[K comparable, V, T any](m map[K]V, fn func(K, V) T) base.Mapper[T]
Map transforms each key-value pair in m using fn and returns the results as a Mapper. All type parameters are inferred from the arguments. Use MapTo[T](m).Map(fn) when explicit type specification is needed. Order is not guaranteed (map iteration order).
Types ¶
type Entries ¶
type Entries[K comparable, V any] = base.Entries[K, V]
Entries is a defined type over map[K]V. Indexing, ranging, and len all work as with a plain map. The zero value is a nil map — safe for reads (len, range) but panics on write. From does not copy; the Entries and the original map share the same backing data.
func From ¶
func From[K comparable, V any](m map[K]V) Entries[K, V]
From converts a map to Entries for fluent operations.
type MapperTo ¶
type MapperTo[T any, K comparable, V any] = base.EntryMapper[T, K, V]
MapperTo wraps a map for cross-type transformation.