Documentation
¶
Index ¶
- func Coalesce[T comparable](alternatives ...T) T
- func CoalesceMap[T ~map[K]V, K comparable, V any](alternatives ...T) T
- func CoalesceSlice[T ~[]V, V any](alternatives ...T) T
- func Max[T constraints.Ordered](a ...T) T
- func Min[T constraints.Ordered](a ...T) T
- func SortWithData[C constraints.Ordered, D any](comparables []C, data []D)
- func Ternary[T any](cond bool, a, b T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶ added in v0.17.0
func Coalesce[T comparable](alternatives ...T) T
Coalesce returns the first argument that's not zero.
func CoalesceMap ¶ added in v0.17.0
func CoalesceMap[T ~map[K]V, K comparable, V any](alternatives ...T) T
CoalesceMap returns the first argument that has a len() of more than 0.
func CoalesceSlice ¶ added in v0.17.0
func CoalesceSlice[T ~[]V, V any](alternatives ...T) T
CoalesceSlice returns the first argument that has a len() of more than 0.
func SortWithData ¶ added in v0.16.0
func SortWithData[C constraints.Ordered, D any](comparables []C, data []D)
SortWithData sorts two slices together. The slices will be sorted in order of comparables. The data slice is only reordered. SortWithData may fail to sort correctly when sorting slices of floating-point numbers containing Not-a-number (NaN) values.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package orderedobject allows you to decode JSON dicts while preserving order.
|
Package orderedobject allows you to decode JSON dicts while preserving order. |
Click to show internal directories.
Click to hide internal directories.