Documentation
¶
Index ¶
- func Coalesce[T comparable](v ...T) (result T, ok bool)
- func GetValueNotEmptyOrDefault[T constraints.Ordered](value, defaultValue T) T
- func Max[T constraints.Ordered](x, y T) T
- func Min[T constraints.Ordered](x T, y T) T
- func Sum[T constraints.Integer | constraints.Float](slices []T) T
- func TernaryF[T any](condition bool, ifFunc func() T, elseFunc func() T) T
- func TernaryOp[T any](condition bool, ifOutput T, elseOutput T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce[T comparable](v ...T) (result T, ok bool)
Coalesce returns the first non-empty arguments. Arguments must be comparable.
func GetValueNotEmptyOrDefault ¶
func GetValueNotEmptyOrDefault[T constraints.Ordered](value, defaultValue T) T
GetValueNotEmptyOrDefault return defaultValue if value is zeroValue, else return value
func Max ¶
func Max[T constraints.Ordered](x, y T) T
func Min ¶
func Min[T constraints.Ordered](x T, y T) T
func Sum ¶
func Sum[T constraints.Integer | constraints.Float](slices []T) T
Sum return sum of array number
func TernaryF ¶
TernaryF is a 1 line if/else statement whose options are functions Play: https://go.dev/play/p/AO4VW20JoqM
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.