Documentation ¶
Index ¶
- Variables
- func Map(mapper interface{}, source interface{}) (interface{}, error)
- func ParallelMap(mapper interface{}, source interface{}) (interface{}, error)
- func Reduce(reducer, source interface{}, initials ...interface{}) (interface{}, error)
- type ArrayEnumerator
- type ArrayIterator
- type Capacitor
- type ChanIterator
- type Container
- type ContainerIterator
- type Enumerator
- type EnumeratorIterator
- type Iterator
- type Length
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotSupported = errors.New("not supported") ErrInvalidChanDir = errors.New("not readable channel") )
View Source
var ( ErrNilMapper = errors.New("mapper function cannot be nil") ErrMapperNotFunc = errors.New("mapper must be a function") ErrInvalidMapper = errors.New("invalid Mapper signature, must be \"mapper(TypeA) TypeB\" or \"mapper(TypeA, int) TypeB\"") )
Map Error Collection
View Source
var ( ErrNilReducer = errors.New("reducer cannot be nil") ErrReducerNotFunc = errors.New("reducer must be a function") ErrMissingInitialValue = errors.New("missing initial value") ErrInvalidReducer = errors.New("invalid reducer signature, must be \"reducer(TypeA, TypeB, int) TypeA\" or \"reducer(TypeA, TypeB) TypeA\"") )
Reducer Error Collection
Functions ¶
func Map ¶
func Map(mapper interface{}, source interface{}) (interface{}, error)
Map maps iteratible objects into another slice. The mapper can be mapper(TypeA, int) TypeB or mapper(TypeA) TypeB The source accept array, slice, channel or Iterator.
func ParallelMap ¶
func ParallelMap(mapper interface{}, source interface{}) (interface{}, error)
ParallelMap maps iteratible objects in parallel.
Types ¶
type ArrayEnumerator ¶ added in v1.2.2
type ArrayEnumerator struct {
// contains filtered or unexported fields
}
func (*ArrayEnumerator) Cap ¶ added in v1.2.2
func (enum *ArrayEnumerator) Cap() int
func (*ArrayEnumerator) Container ¶ added in v1.2.2
func (enum *ArrayEnumerator) Container() interface{}
func (*ArrayEnumerator) Item ¶ added in v1.2.2
func (enum *ArrayEnumerator) Item(i int) interface{}
func (*ArrayEnumerator) Len ¶ added in v1.2.2
func (enum *ArrayEnumerator) Len() int
type ArrayIterator ¶
type ArrayIterator struct {
ContainerIterator
}
func (*ArrayIterator) Next ¶
func (iter *ArrayIterator) Next() bool
func (*ArrayIterator) Value ¶
func (iter *ArrayIterator) Value() (int, interface{})
type ChanIterator ¶
type ChanIterator struct { ContainerIterator // contains filtered or unexported fields }
func (*ChanIterator) Next ¶
func (iter *ChanIterator) Next() (ok bool)
func (*ChanIterator) Value ¶
func (iter *ChanIterator) Value() (int, interface{})
type ContainerIterator ¶
type ContainerIterator struct {
// contains filtered or unexported fields
}
func (*ContainerIterator) Cap ¶
func (iter *ContainerIterator) Cap() int
func (*ContainerIterator) Container ¶ added in v1.2.2
func (iter *ContainerIterator) Container() interface{}
func (*ContainerIterator) Len ¶
func (iter *ContainerIterator) Len() int
type Enumerator ¶ added in v1.2.2
func NewEnumerator ¶ added in v1.2.2
func NewEnumerator(slice interface{}) (Enumerator, error)
type EnumeratorIterator ¶ added in v1.2.2
type EnumeratorIterator struct { Enumerator // contains filtered or unexported fields }
func (*EnumeratorIterator) Next ¶ added in v1.2.2
func (enum *EnumeratorIterator) Next() bool
func (*EnumeratorIterator) Value ¶ added in v1.2.2
func (enum *EnumeratorIterator) Value() (int, interface{})
type Iterator ¶
func NewIterator ¶
Click to show internal directories.
Click to hide internal directories.