mapx

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterFunc

func FilterFunc[K comparable, V any](oldMap map[K]V, cmp func(key K, val V) (ok bool)) (newMap map[K]V)

FilterFunc filters a map by a custom function, the function should return a boolean indicating if the key should be included.

func FilterWithPrefix

func FilterWithPrefix[V any](oldMap map[string]V, prefix string) (newMap map[string]V)

FilterWithPrefix filters a map by a prefix, only keys with the prefix will be included.

func ProjectFunc

func ProjectFunc[K comparable, V any](oldMap map[K]V, proj func(oldKey K, val V) (newKey K, ok bool)) (newMap map[K]V)

ProjectFunc projects a map by a custom function, the function should return the new key and a boolean indicating if the key should be included.

func ProjectWithPrefix

func ProjectWithPrefix[V any](oldMap map[string]V, prefix string) (newMap map[string]V)

ProjectWithPrefix projects a map by a prefix, only keys with the prefix will be included, and the prefix will be removed from the keys.

Types

This section is empty.

Jump to

Keyboard shortcuts

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