maputils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[K comparable, T comparable](e T, values map[K]T) *T

Contains checks if map contains specified element. Returns value if found, nil otherwise.

func ContainsPredicate

func ContainsPredicate[K comparable, T any](predicate func(k K, v *T) bool, values map[K]T) *T

ContainsPredicate checks if map contains specified struct element matching a predicate. Returns value if found, nil otherwise.

func Copy

func Copy[K comparable, T any](m1 map[K]T) map[K]T

Copy returns a copy of a map

func Equals

func Equals[K comparable, T comparable](m1 map[K]T, m2 map[K]T) bool

Equals returns true if maps are equal. Map order is ignored.

func EqualsP

func EqualsP[K comparable, T any](m1 map[K]T, m2 map[K]T, equals func(t1 T, t2 T) bool) bool

EqualsP returns true if maps are equal. Map order is ignored. Values are compared using predicate

func Keys

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

func Merge

func Merge[K comparable, T any](src map[K]T, add map[K]T) map[K]T

Merge merges two maps and returns the result. Existing keys from src map will be used.

func Values

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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