mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2026-04-22 15:57:06 +08:00
Feature/0723 docs update (#103)
This commit is contained in:
+1
-1
@@ -60,5 +60,5 @@ func ToUint64(i any) (uint64, error)
|
||||
func ToBool(i any) bool
|
||||
|
||||
// Ternary 三元运算符
|
||||
func Ternary[T any](expr bool, a, b T) T
|
||||
func Ternary(expr bool, a, b T) T
|
||||
```
|
||||
+2
-2
@@ -24,8 +24,8 @@ func KeyExists((m map[T]T2, key T)) bool
|
||||
func ValueExists(m map[T2]T, value T) bool
|
||||
|
||||
// Keys 提取的所有键
|
||||
func Keys[K comparable, V any](m map[K]V) []K
|
||||
func Keys(m map[K]V) []K
|
||||
|
||||
// Values 提取的所有值
|
||||
func Values[K comparable, V any](m map[K]V) []V
|
||||
func Values(m map[K]V) []V
|
||||
```
|
||||
+5
-5
@@ -39,17 +39,17 @@ func Sum(slice []T) T
|
||||
func Unique(slice []T) []T
|
||||
|
||||
// ToMap 切片转map
|
||||
func ToMap[T any, K comparable](items []T, keyFunc func(T) K) map[K]T
|
||||
func ToMap(items []T, keyFunc func(T) K) map[K]T
|
||||
|
||||
// Pluck 字段提取
|
||||
func Pluck[T any, K comparable](items []T, keyFunc func(T) K) []K
|
||||
func Pluck(items []T, keyFunc func(T) K) []K
|
||||
|
||||
// Diff 计算差集
|
||||
func Diff[T comparable](s []T, slices ...[]T) []T
|
||||
func Diff(s []T, slices ...[]T) []T
|
||||
|
||||
// SymmetricDiff 计算对称差集
|
||||
func SymmetricDiff[T comparable](slices ...[]T) []T
|
||||
func SymmetricDiff(slices ...[]T) []T
|
||||
|
||||
// Intersect 计算交集
|
||||
func Intersect[T comparable](slices ...[]T) []T
|
||||
func Intersect(slices ...[]T) []T
|
||||
```
|
||||
+4
-1
@@ -48,5 +48,8 @@ func ToUint32(v string) uint32
|
||||
func ToUint64(v string) uint64
|
||||
|
||||
// ToBytes 字符串转字节数组
|
||||
func ToBytes(v string) []byte
|
||||
func ToBytes(v string) []byte
|
||||
|
||||
// Cut 删除 s 中出现的 sub 字符串
|
||||
func Cut(s, sub string, n ...int) string
|
||||
```
|
||||
Reference in New Issue
Block a user