Documentation ¶
Index ¶
- func Each[K comparable, V any](items map[K]V, consumer func(item V, key K))
- func Filter[K comparable, V any](items map[K]V, predicate func(item V, key K) bool) map[K]V
- func Keys[T any, K comparable](input map[K]T) []K
- func Map[T any, K comparable, V any](items map[K]V, mapper func(item V, key K) T) map[K]T
- func OrderedEach[K Ordered, V any](items map[K]V, consumer func(item V, key K))
- func OrderedEachBy[K Ordered, V any](items map[K]V, consumer func(item V, key K), orderBy func(k1, k2 K) bool)
- func OrderedEachByValue[K Ordered, V any](items map[K]V, consumer func(item V, key K), orderBy func(v1, v2 V) bool)
- func OrderedKeys[K Ordered, V any](items map[K]V) []K
- func OrderedKeysBy[K Ordered, V any](items map[K]V, orderBy func(k1, k2 K) bool) []K
- func OrderedKeysReverse[K Ordered, V any](items map[K]V) []K
- func OrderedReduce[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
- func OrderedReduceBy[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R, ...) R
- func OrderedReduceReverse[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
- func OrderedReduceWithKey[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
- func OrderedReduceWithKeyReverse[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
- func Reduce[K comparable, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
- func ReduceWithKey[K comparable, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
- func Values[T any, K comparable](input map[K]T) []T
- type Ordered
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Each ¶
func Each[K comparable, V any](items map[K]V, consumer func(item V, key K))
Each 对每一个元素做 consumer 操作
func Filter ¶
func Filter[K comparable, V any](items map[K]V, predicate func(item V, key K) bool) map[K]V
Filter 对每一个元素做 filter 操作
func Map ¶
func Map[T any, K comparable, V any](items map[K]V, mapper func(item V, key K) T) map[K]T
Map 依次对每一个元素做 mapper 操作
func OrderedEach ¶
OrderedEach 对每一个元素做 consumer 操作,对 Map 的 Key 进行排序后再遍历
func OrderedEachBy ¶
func OrderedEachBy[K Ordered, V any](items map[K]V, consumer func(item V, key K), orderBy func(k1, k2 K) bool)
OrderedEachBy 对每一个元素做 consumer 操作,对 Map 的 Key 进行排序后再遍历,通过 orderBy 指定排序规则
func OrderedEachByValue ¶
func OrderedEachByValue[K Ordered, V any](items map[K]V, consumer func(item V, key K), orderBy func(v1, v2 V) bool)
OrderedEachByValue 对每一个元素做 consumer 操作,对 Map 的 Key 进行排序后再遍历,通过 orderBy 指定排序规则
func OrderedKeys ¶
OrderedKeys 将 map 的 key 转换为数组,并按照 key 的顺序进行排序
func OrderedKeysBy ¶
OrderedKeysBy 将 map 的 key 转换为数组,并按照 key 使用 orderBy 函数排序
func OrderedKeysReverse ¶
OrderedKeys 将 map 的 key 转换为数组,并按照 key 的顺序进行排序(倒序)
func OrderedReduce ¶
func OrderedReduce[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
OrderedReduce 对 map 执行 reduce 操作
func OrderedReduceBy ¶
func OrderedReduceBy[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R, orderBy func(k1, k2 K) bool) R
OrderedReduceBy 对 map 执行 reduce 操作
func OrderedReduceReverse ¶
func OrderedReduceReverse[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
OrderedReduceReverse 对 map 执行 reduce 操作
func OrderedReduceWithKey ¶
func OrderedReduceWithKey[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
OrderedReduceWithKey 对 map 执行 reduce 操作
func OrderedReduceWithKeyReverse ¶
func OrderedReduceWithKeyReverse[K Ordered, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
OrderedReduceWithKeyReverse 对 map 执行 reduce 操作
func Reduce ¶
func Reduce[K comparable, V any, R any](items map[K]V, reducer func(result R, item V) R, init R) R
Reduce 对 map 执行 reduce 操作
func ReduceWithKey ¶
func ReduceWithKey[K comparable, V any, R any](items map[K]V, reducer func(result R, item V, key K) R, init R) R
ReduceWithKey 对 map 执行 reduce 操作