collect

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package collect provide functions for manipulating collections via reflect

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapKeys

func MapKeys(value interface{}) interface{}

MapKeys func returns all of the map keys as slice

func MapMap

func MapMap(value interface{}, mapFunc interface{}) interface{}

MapMap func iterates through the map and passes each value to the given mapFunc. The mapFunc is free to modify the item and return it, thus forming a new slice of modified items

func MapMapWithKeys

func MapMapWithKeys(value interface{}, mapFunc interface{}) interface{}

MapMapWithKeys func iterates through the map and passes each key and value to the given mapFunc. The mapFunc should return a single key / value pair

func MapReduce

func MapReduce(mapValue interface{}, initialValue interface{}, reduceFunc interface{}) interface{}

MapReduce method reduces the map to a single value, passing the result of each iteration into the subsequent iteration:

func MapUnique

func MapUnique(value interface{}) interface{}

MapUnique method returns all of the unique items in the map as new slice

func SliceMap

func SliceMap(value interface{}, mapFunc interface{}) interface{}

SliceMap func iterates through the slice and passes each value to the given mapFunc. The mapFunc is free to modify the item and return it, thus forming a new slice of modified items

func SliceMapWithKeys

func SliceMapWithKeys(value interface{}, mapFunc interface{}) interface{}

SliceMapWithKeys func iterates through the slice and passes each key and value to the given mapFunc. The mapFunc should return a single key / value pair

func SliceReduce

func SliceReduce(value interface{}, initialValue interface{}, mapFunc interface{}) interface{}

SliceReduce method reduces the slice to a single value, passing the result of each iteration into the subsequent iteration:

func SliceUnique

func SliceUnique(value interface{}) interface{}

SliceUnique method returns all of the unique items in the slice as new slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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