reducer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotCollection = xerrors.New("expected an array or a map")

Functions

func Pipe

func Pipe(input interface{}, reducers ...Interface) (interface{}, error)

Types

type Filter

type Filter struct {
	Func func(value, key, collection interface{}) (bool, error)
}

func (Filter) Reduce

func (f Filter) Reduce(input interface{}) (interface{}, error)

type Interface

type Interface interface {
	Reduce(input interface{}) (interface{}, error)
}

type Map

type Map struct {
	Func func(value, key, collection interface{}) (interface{}, error)
}

func (Map) Reduce

func (m Map) Reduce(input interface{}) (interface{}, error)

type Merge

type Merge struct {
	Source interface{}
}

func (Merge) Reduce

func (m Merge) Reduce(input interface{}) (interface{}, error)

type Unique

type Unique struct {
	Func func(value, key, collection interface{}) (interface{}, error)
}

func (Unique) Reduce

func (u Unique) Reduce(input interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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