collections

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 1 Imported by: 45

Documentation

Overview

Package collections contains helper functions for interacting with collection structs like Slices and Maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchListIntoGroupsOf

func BatchListIntoGroupsOf(slice []string, batchSize int) [][]string

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 Keys

func Keys(m map[string]string) []string

Return the keys for the given map, sorted alphabetically

func ListContainsElement

func ListContainsElement(list []string, element string) bool

Return true if the given list contains the given element

func MakeCopyOfList

func MakeCopyOfList(list []string) []string

MakeCopyOfList will return a new list that is a copy of the given list.

func MergeMaps

func MergeMaps(maps ...map[string]interface{}) map[string]interface{}

Merge all the maps into one. Sadly, Go has no generics, so this is only defined for string to interface maps.

func RemoveElementFromList

func RemoveElementFromList(list []string, element string) []string

Return a copy of the given list with all instances of the given element removed

Types

This section is empty.

Jump to

Keyboard shortcuts

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