Documentation ¶
Overview ¶
Package item provides helper types and constraints for Stream operator
Index ¶
- func Add[T Addable](a, b T) T
- func Equals[T comparable](reference T) func(i T) bool
- func GreaterThan[T constraints.Ordered](reference T) func(i T) bool
- func GreaterThanOrEq[T constraints.Ordered](reference T) func(i T) bool
- func Increment[T Number](a T) T
- func IsZero[T comparable](input T) bool
- func LessThan[T constraints.Ordered](reference T) func(i T) bool
- func LessThanOrEq[T constraints.Ordered](reference T) func(i T) bool
- func Multiply[T Number](a, b T) T
- func Neg[T Number](a T) T
- func Not[T any](condition func(i T) bool) func(i T) bool
- type Addable
- type Number
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equals ¶
func Equals[T comparable](reference T) func(i T) bool
Equals returns a predicate that is true when the checked value is equal to the provided reference.
func GreaterThan ¶
func GreaterThan[T constraints.Ordered](reference T) func(i T) bool
GreaterThan returns a predicate that is true when the checked value is larger than the provided reference.
func GreaterThanOrEq ¶
func GreaterThanOrEq[T constraints.Ordered](reference T) func(i T) bool
GreaterThanOrEq returns a predicate that is true when the checked value is equal or larger than the provided reference.
func IsZero ¶
func IsZero[T comparable](input T) bool
IsZero returns true if the input value corresponds to the zero value of its type: 0 for numeric values, empty string, false, nil pointer, etc...
func LessThan ¶
func LessThan[T constraints.Ordered](reference T) func(i T) bool
LessThan returns a predicate that is true when the checked value is less than the provided reference.
func LessThanOrEq ¶
func LessThanOrEq[T constraints.Ordered](reference T) func(i T) bool
LessThanOrEq returns a predicate that is true when the checked value is equal or less than the provided reference.
Types ¶
type Addable ¶
type Addable interface { constraints.Ordered | constraints.Complex }
Number constraint any type that define the addition + operation, and their subtypes
type Number ¶
type Number interface { constraints.Integer | constraints.Float | constraints.Complex }
Number constraint: ints, uints, complexes, floats and all their subtypes
type Pair ¶
type Pair[K comparable, V any] struct { Key K Val V }
Pair of Key-Value made to manage maps and other key-value structures TODO: use "constraints.Map" when it is defined in the constraints package