reducers

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func First

func First[KeyOut, ValueOut any](_ KeyOut, values []ValueOut) ValueOut

First is a reducer that returns the first value of the values passed to it.

func Last

func Last[KeyOut, ValueOut any](_ KeyOut, values []ValueOut) ValueOut

Last is a reducer that returns the last value of the values passed to it.

func MaxPrimitive

func MaxPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut

MaxPrimitive is a reducer that returns the maximum value of the values passed to it.

func MinPrimitive

func MinPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut

MinPrimitive is a reducer that returns the minimum value of the values passed to it.

func NewMaxField added in v0.5.2

func NewMaxField[KeyOut, ValueOut, ValueField any](
	getter func(value ValueOut) ValueField,
	comparator comparison.Comparator[ValueField],
) meduce.Reducer[KeyOut, ValueOut]

NewMaxField creates a reducer that returns the value with maximal field.

The reducer requires a getter function that returns fields that are compared. Comparator function is also required for comparing returned fields. Comparator function is also required for comparing returned fields.

func NewMaxOrderedField added in v0.5.2

func NewMaxOrderedField[KeyOut, ValueOut any, ValueField cmp.Ordered](getter func(value ValueOut) ValueField) meduce.Reducer[KeyOut, ValueOut]

NewMaxOrderedField creates a reducer that returns the value with maximal field.

The reducer requires a getter function that returns ordered fields that are natively compared.

func NewMinField added in v0.5.2

func NewMinField[KeyOut, ValueOut, ValueField any](
	getter func(value ValueOut) ValueField,
	comparator comparison.Comparator[ValueField],
) meduce.Reducer[KeyOut, ValueOut]

NewMinField creates a reducer that returns the value with minimal field.

The reducer requires a getter function that returns fields that are compared. Comparator function is also required for comparing returned fields.

func NewMinOrderedField added in v0.5.2

func NewMinOrderedField[KeyOut, ValueOut any, ValueField cmp.Ordered](getter func(value ValueOut) ValueField) meduce.Reducer[KeyOut, ValueOut]

NewMinOrderedField creates a reducer that returns the value with minimal field.

The reducer requires a getter function that returns ordered fields that are natively compared.

func SumPrimitive

func SumPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut

SumPrimitive is a reducer that returns the sum of the values passed to it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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