maputil

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 1 Imported by: 42

Documentation

Overview

Package maputil includes some functions to manipulate map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[K comparable, V any](m map[K]V, predicate func(key K, value V) bool) map[K]V

Filter iterates over map, return a new map contains all key and value pairs pass the predicate function

func ForEach

func ForEach[K comparable, V any](m map[K]V, iteratee func(key K, value V))

ForEach executes iteratee funcation for every key and value pair in map

func Intersect

func Intersect[K comparable, V any](maps ...map[K]V) map[K]V

Intersect iterates over maps, return a new map of key and value pairs in all given maps

func Keys

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

Keys returns a slice of the map's keys

func Merge

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

Merge maps, next key will overwrite previous key

func Minus

func Minus[K comparable, V any](mapA, mapB map[K]V) map[K]V

Minus creates an map of whose key in mapA but not in mapB

func Values

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

Values returns a slice of the map's values

Types

This section is empty.

Jump to

Keyboard shortcuts

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