mapper

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v1.0.33

func Copy[K comparable, V any](m map[K]V) map[K]V

func Each

func Each[K comparable, V any](m map[K]V, fn func(K, V))

func EachErr

func EachErr[K comparable, V any](m map[K]V, fn func(K, V) error) error

func Filter added in v1.0.33

func Filter[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V

func FilterErr added in v1.0.33

func FilterErr[K comparable, V any](m map[K]V, fn func(K, V) (bool, error)) (map[K]V, error)

func Has

func Has[K comparable, V any](m map[K]V, k K) bool

func Keys

func Keys[K comparable, V any](m map[K]V) []K

func KeysFiltered

func KeysFiltered[K comparable, V any](m map[K]V, fn func(K) bool) []K

func Map added in v1.0.33

func Map[K comparable, V any, R any](m map[K]V, fn func(k K, v V) R) []R

func MapErr added in v1.0.33

func MapErr[K comparable, V any, R any](m map[K]V, fn func(k K, v V) (R, error)) ([]R, error)

func MergeCopy added in v1.0.33

func MergeCopy[K comparable, V any](m1, m2 map[K]V) map[K]V

func MergeInto added in v1.0.33

func MergeInto[K comparable, V any](dst map[K]V, src map[K]V)

func Reject added in v1.0.33

func Reject[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V

func RejectErr added in v1.0.33

func RejectErr[K comparable, V any](m map[K]V, fn func(K, V) (bool, error)) (map[K]V, error)

func Upsert added in v1.0.35

func Upsert[T any, C comparable](m map[C]T, k C, t T) bool

func UpsertFn added in v1.0.35

func UpsertFn[T any, C comparable](m map[C]T, fn func(T) C, t T) bool

func Values

func Values[K comparable, V any](m map[K]V) []V

func ValuesFiltered

func ValuesFiltered[K comparable, V any](m map[K]V, fn func(V) bool) []V

Types

type Item

type Item[K comparable, V any] struct {
	K K
	V V
}

func Items

func Items[K comparable, V any](m map[K]V) []Item[K, V]

func ItemsFiltered

func ItemsFiltered[K comparable, V any](m map[K]V, fn func(K, V) bool) []Item[K, V]

type Mapper

type Mapper[K comparable, V any] map[K]V

func (Mapper[K, V]) Each

func (t Mapper[K, V]) Each(fn func(K, V))

func (Mapper[K, V]) EachErr

func (t Mapper[K, V]) EachErr(fn func(K, V) error) error

func (Mapper[K, V]) Has

func (t Mapper[K, V]) Has(k K) bool

func (Mapper[K, V]) Items

func (t Mapper[K, V]) Items() []Item[K, V]

func (Mapper[K, V]) Keys

func (t Mapper[K, V]) Keys() []K

func (Mapper[K, V]) KeysFiltered

func (t Mapper[K, V]) KeysFiltered(fn func(K) bool) []K

func (Mapper[K, V]) Values

func (t Mapper[K, V]) Values() []V

func (Mapper[K, V]) ValuesFiltered

func (t Mapper[K, V]) ValuesFiltered(fn func(V) bool) []V

Jump to

Keyboard shortcuts

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