Documentation ¶
Index ¶
- func First[KeyOut, ValueOut any](_ KeyOut, values []ValueOut) ValueOut
- func Last[KeyOut, ValueOut any](_ KeyOut, values []ValueOut) ValueOut
- func MaxPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut
- func MinPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut
- func NewMaxField[KeyOut, ValueOut, ValueField any](getter func(value ValueOut) ValueField, ...) meduce.Reducer[KeyOut, ValueOut]
- func NewMaxOrderedField[KeyOut, ValueOut any, ValueField cmp.Ordered](getter func(value ValueOut) ValueField) meduce.Reducer[KeyOut, ValueOut]
- func NewMinField[KeyOut, ValueOut, ValueField any](getter func(value ValueOut) ValueField, ...) meduce.Reducer[KeyOut, ValueOut]
- func NewMinOrderedField[KeyOut, ValueOut any, ValueField cmp.Ordered](getter func(value ValueOut) ValueField) meduce.Reducer[KeyOut, ValueOut]
- func SumPrimitive[KeyOut any, ValueOut cmp.Ordered](_ KeyOut, values []ValueOut) ValueOut
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 ¶
MaxPrimitive is a reducer that returns the maximum value of the values passed to it.
func MinPrimitive ¶
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 ¶
SumPrimitive is a reducer that returns the sum of the values passed to it.
Types ¶
This section is empty.