transform

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 2 Imported by: 3

README

transform package

Functional transformation should be put here, i.e. side effect free actions. Others should be put into utils pkg.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count added in v1.5.0

func Count[T any](col types.Collection[T], conditionFunc func(elem T) bool) int

func CountSlice added in v1.5.0

func CountSlice[T any](arr []T, conditionFunc func(elem T) bool) int

func FilterFlatMapSliceTo added in v1.5.0

func FilterFlatMapSliceTo[T any, R any](src []T, tgt types.Collection[R], filterFn func(elem T) bool, mapFn func(elem T) []R) int

FilterFlatMapSliceTo filters and transforms elem into another Collection, returns transformed elem count collected

func FilterFlatMapTo

func FilterFlatMapTo[T any, R any](src types.Collection[T], tgt types.Collection[R], filterFn func(elem T) bool, mapFn func(elem T) []R) int

FilterFlatMapTo filters and transforms elem into another Collection, returns transformed elem count collected

func FilterMapSliceTo added in v1.5.0

func FilterMapSliceTo[T any, R any](src []T, tgt types.Collection[R], filterFn func(elem T) bool, mapFn func(elem T) R) int

FilterMapSliceTo filters and transforms elem into another Collection, returns elem count collected

func FilterMapTo

func FilterMapTo[T any, R any](src types.Collection[T], tgt types.Collection[R], filterFn func(elem T) bool, mapFn func(elem T) R) int

FilterMapTo filters and transforms elem into another Collection, returns elem count collected

func FilterSliceTo added in v1.5.0

func FilterSliceTo[T any](src []T, tgt types.Collection[T], filterFn func(elem T) bool) int

FilterSliceTo filters elem into another Collection, returns elem count collected

func FilterTo

func FilterTo[T any](src types.Collection[T], tgt types.Collection[T], filterFn func(elem T) bool) int

FilterTo filters elem into another Collection, returns elem count collected

func FlatMapSliceTo added in v1.5.0

func FlatMapSliceTo[T any, R any](src []T, tgt types.Collection[R], mapFn func(elem T) []R) int

FlatMapSliceTo transforms elem into another Collection, returns transformed elem count collected

func FlatMapTo

func FlatMapTo[T any, R any](src types.Collection[T], tgt types.Collection[R], mapFn func(elem T) []R) int

FlatMapTo transforms elem into another Collection, returns transformed elem count collected

func FlattenSliceTo added in v1.5.0

func FlattenSliceTo[T any](src [][]T, tgt types.Collection[T]) int

func FlattenTo added in v1.5.0

func FlattenTo[C types.Collection[T], T any](src types.Collection[C], tgt types.Collection[T]) int

func MapSliceTo added in v1.5.0

func MapSliceTo[T any, R any](src []T, tgt types.Collection[R], mapFn func(elem T) R) int

MapSliceTo transforms elem into another Collection, returns elem count collected

func MapTo

func MapTo[T any, R any](src types.Collection[T], tgt types.Collection[R], mapFn func(elem T) R) int

MapTo transforms elem into another Collection, returns elem count collected

func Reduce added in v1.4.0

func Reduce[T any, R any](col types.Collection[T], identity R, reduceFn func(acc R, next T) R) R

func ReduceSlice added in v1.5.0

func ReduceSlice[T any, R any](arr []T, identity R, reduceFn func(acc R, next T) R) R

func Sum added in v1.12.0

func Sum[T constraints.Ordered](col types.Collection[T]) T

func SumSlice added in v1.12.0

func SumSlice[T constraints.Ordered](arr []T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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