algorithm

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkStrings

func ChunkStrings(targets []string, chunkSize int) [][]string

ChunkStrings will split slice of String into chunks

func DiffStringMap

func DiffStringMap(desired map[string]string, current map[string]string) (map[string]string, map[string]string)

DiffStringMap will diff desired with current. Returns the k/v that need to be add/updated and k/v that need to be deleted to make current match desired.

func MapFindFirst

func MapFindFirst(key string, maps ...map[string]string) (string, bool)

MapFindFirst get from list of maps until first found.

func MergeStringMap

func MergeStringMap(maps ...map[string]string) map[string]string

MergeStringMap will merge multiple map[string]string into single one. The merge is executed for maps argument in sequential order, if a key already exists, the value from previous map is kept. e.g. MergeStringMap(map[string]string{"a": "1", "b": "2"}, map[string]string{"a": "3", "d": "4"}) == map[string]string{"a": "1", "b": "2", "d": "4"}

Types

This section is empty.

Jump to

Keyboard shortcuts

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