Documentation ¶
Overview ¶
Package collections contains helper functions for interacting with collection structs like Slices and Maps.
Index ¶
- Constants
- func BatchListIntoGroupsOf(slice []string, batchSize int) [][]string
- func KeyValueStringSlice(m map[string]string) []string
- func KeyValueStringSliceWithFormat(m map[string]string, format string) []string
- func Keys(m map[string]string) []string
- func ListContainsElement(list []string, element string) bool
- func MakeCopyOfList(list []string) []string
- func MergeMaps(maps ...map[string]interface{}) map[string]interface{}
- func RemoveElementFromList(list []string, element string) []string
Constants ¶
const (
DefaultKeyValueStringSliceFormat = "%s=%s"
)
Variables ¶
This section is empty.
Functions ¶
func BatchListIntoGroupsOf ¶
BatchListIntoGroupsOf will group the provided string slice into groups of size n, with the last of being truncated to the remaining count of strings. Returns nil if n is <= 0
func KeyValueStringSlice ¶ added in v0.12.5
KeyValueStringSlice returns a string slice with key=value items, sorted alphabetically
func KeyValueStringSliceWithFormat ¶ added in v0.12.5
KeyValueStringSliceWithFormat returns a string slice using the specified format, sorted alphabetically. The format should consist of at least two '%s' string verbs.
func ListContainsElement ¶
Return true if the given list contains the given element
func MakeCopyOfList ¶
MakeCopyOfList will return a new list that is a copy of the given list.
func MergeMaps ¶
Merge all the maps into one. Sadly, Go has no generics, so this is only defined for string to interface maps.
func RemoveElementFromList ¶
Return a copy of the given list with all instances of the given element removed
Types ¶
This section is empty.