maps

package
v1.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromString

func FromString(keyValuePairs string) map[string]string

FromString Converts a string with comma separated key-value pairs to a map[string]string

func GetKeysFromMap

func GetKeysFromMap[T comparable, V any](m map[T]V) []T

GetKeysFromMap returns the keys of a map

func GetValueFromMap

func GetValueFromMap[T comparable, V any](m map[T]V, key T, defaultValue V) V

GetValueFromMap Returns the value of a key from a map If the key does not exist, the default value is returned

func MergeMaps

func MergeMaps[T comparable, V any](sources ...map[T]V) map[T]V

MergeMaps combines two maps into one map. Maps are merged from the beginning of the sources slice, in case of key conflicts, values from source map with higher index will overwrite the previous ones.

func ToString

func ToString(keyValues map[string]string) string

ToString Converts map[string]string to a string with comma separated key-vaults, spaces are trimmed

Types

This section is empty.

Jump to

Keyboard shortcuts

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