mapz

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 4 Imported by: 0

README

gopherz

ezpkg.io/mapz

PkgGoDev GitHub License version

Package mapz extends the package golang.org/x/exp/maps with additional functions.

Installation

go get -u ezpkg.io/[email protected]

Examples

mapCodes := mapz.FromSliceFunc([]int{1, 2, 3}, func(i int) string {
    return fmt.Sprintf("CODE(%d)", i)
})
fmt.Println(mapCodes)

Similar Packages

This package is based on:

About ezpkg.io

As I work on various Go projects, I often find myself creating utility functions, extending existing packages, or developing packages to solve specific problems. Moving from one project to another, I usually have to copy or rewrite these solutions. So I created this repository to have all these utilities and packages in one place. Hopefully, you'll find them useful as well.

For more information, see the main repository.

Author

Oliver Nguyen  github

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append added in v0.1.2

func Append[M ~map[K]V, K comparable, V any](m M, items map[K]V) map[K]V

func Exists added in v0.1.2

func Exists[M ~map[K]V, K comparable, V any](m M, key K) bool

func ExistsAll added in v0.1.2

func ExistsAll[M ~map[K]V, K comparable, V any](m M, keys ...K) bool

func ExistsAny added in v0.1.2

func ExistsAny[M ~map[K]V, K comparable, V any](m M, keys ...K) bool

func ExistsFunc added in v0.1.2

func ExistsFunc[M ~map[K]V, K comparable, V any](m M, fn func(K, V) bool) bool

func FilterFunc added in v0.1.2

func FilterFunc[M ~map[K]V, K comparable, V any](m M, fn func(K, V) bool) map[K]V

func FilterKeys added in v0.1.2

func FilterKeys[M ~map[K]V, K comparable, V any](m M, keys ...K) map[K]V

func FilterValues added in v0.1.2

func FilterValues[M ~map[K]V, K, V comparable](m M, values ...V) map[K]V

func FromSliceFunc

func FromSliceFunc[S ~[]E, E comparable, R any](s S, fn func(E) R) map[E]R

func Merge added in v0.1.2

func Merge[M ~map[K]V, K comparable, V any](maps ...M) map[K]V

func SortedKeys

func SortedKeys[M ~map[K]V, K constraints.Ordered, V any](m M) []K

func SortedKeysAndValues added in v0.1.1

func SortedKeysAndValues[M ~map[K]V, K constraints.Ordered, V any](m M) ([]K, []V)

Types

This section is empty.

Jump to

Keyboard shortcuts

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