Documentation ¶
Index ¶
- func Copy[K constraints.Ordered, V any](m map[K]V) map[K]V
- func Filter[K constraints.Ordered, V any](m map[K]V, pred func(K, V) bool) map[K]V
- func FilterMap[K constraints.Ordered, V1, V2 any](m map[K]V1, pred func(K, V1) (V2, bool)) map[K]V2
- func Keys[K constraints.Ordered, V any](m map[K]V) []K
- func ListAppend[K constraints.Ordered, V any](m map[K][]V, k K, v V, exist bool) bool
- func ListInsert[K constraints.Ordered, V constraints.Ordered](m map[K][]V, k K, v V, exist bool) bool
- func ListRemove[K constraints.Ordered, V constraints.Ordered](m map[K][]V, k K, v V) bool
- func Map[K constraints.Ordered, V1, V2 any](m map[K]V1, fun func(K, V1) V2) map[K]V2
- func Merge[K constraints.Ordered, V any](m1, m2 map[K]V) map[K]V
- func MergeWith[K constraints.Ordered, V any](m1, m2 map[K]V, combiner func(k K, v1, v2 V) V) map[K]V
- func MergeWithAdd[K constraints.Ordered, V types.Number](m1, m2 map[K]V) map[K]V
- func MergeWithSub[K constraints.Ordered, V types.Number](m1, m2 map[K]V) map[K]V
- func Values[K constraints.Ordered, V any](m map[K]V) []V
- func With[K constraints.Ordered, V any](m map[K]V, keys []K) map[K]V
- func Without[K constraints.Ordered, V any](m map[K]V, keys []K) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[K constraints.Ordered, V any](m map[K]V, pred func(K, V) bool) map[K]V
Filter 字典过滤,移除不满足pred函数的元素
func FilterMap ¶
func FilterMap[K constraints.Ordered, V1, V2 any](m map[K]V1, pred func(K, V1) (V2, bool)) map[K]V2
FilterMap 过滤字典并映射
func ListAppend ¶
func ListAppend[K constraints.Ordered, V any](m map[K][]V, k K, v V, exist bool) bool
ListAppend 列表扩展
func ListInsert ¶
func ListInsert[K constraints.Ordered, V constraints.Ordered](m map[K][]V, k K, v V, exist bool) bool
ListInsert 列表插入
func ListRemove ¶
func ListRemove[K constraints.Ordered, V constraints.Ordered](m map[K][]V, k K, v V) bool
ListRemove 列表移除
func Map ¶
func Map[K constraints.Ordered, V1, V2 any](m map[K]V1, fun func(K, V1) V2) map[K]V2
Map 字典映射
func Merge ¶
func Merge[K constraints.Ordered, V any](m1, m2 map[K]V) map[K]V
Merge 合并两个map,存在相同key时使用m2中的值
func MergeWith ¶
func MergeWith[K constraints.Ordered, V any](m1, m2 map[K]V, combiner func(k K, v1, v2 V) V) map[K]V
MergeWith 合并两个map,存在相同key时使用combiner函数的返回值
func MergeWithAdd ¶
func MergeWithAdd[K constraints.Ordered, V types.Number](m1, m2 map[K]V) map[K]V
MergeWithAdd 合并两个map,存在相同key时将其值相加
func MergeWithSub ¶
func MergeWithSub[K constraints.Ordered, V types.Number](m1, m2 map[K]V) map[K]V
func With ¶
func With[K constraints.Ordered, V any](m map[K]V, keys []K) map[K]V
With 保留字典中键在keys列表中的项
func Without ¶
func Without[K constraints.Ordered, V any](m map[K]V, keys []K) map[K]V
Without 保留字典中键不在keys列表中的项
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.