Installation
go get github.com/thoas/go-funk
Usage
import "github.com/thoas/go-funk"
Doc index
doc文档参考:funk package - github.com/thoas/go-funk - pkg.go.dev
Index ¶
- func All(objs ...interface{}) bool
- func AllPredicates(value interface{}, predicates interface{}) bool
- func Any(objs ...interface{}) bool
- func AnyPredicates(value interface{}, predicates interface{}) bool
- func Chunk(arr interface{}, size int) interface{}
- func ChunkFloat64s(arr []float64, size int) [][]float64
- func ChunkInt32s(arr []int32, size int) [][]int32
- func ChunkInt64s(arr []int64, size int) [][]int64
- func ChunkInts(arr []int, size int) [][]int
- func ChunkStrings(arr []string, size int) [][]string
- func Compact(value interface{}) interface{}
- func Contains(in interface{}, elem interface{}) bool
- func ContainsBool(s []bool, v bool) bool
- func ContainsFloat32(s []float32, v float32) bool
- func ContainsFloat64(s []float64, v float64) bool
- func ContainsInt(s []int, v int) bool
- func ContainsInt32(s []int32, v int32) bool
- func ContainsInt64(s []int64, v int64) bool
- func ContainsString(s []string, v string) bool
- func ContainsUInt(s []uint, v uint) bool
- func ContainsUInt32(s []uint32, v uint32) bool
- func ContainsUInt64(s []uint64, v uint64) bool
- func ConvertSlice(in interface{}, out interface{})
- func Difference(x interface{}, y interface{}) (interface{}, interface{})
- func DifferenceInt(x []int, y []int) ([]int, []int)
- func DifferenceInt32(x []int32, y []int32) ([]int32, []int32)
- func DifferenceInt64(x []int64, y []int64) ([]int64, []int64)
- func DifferenceString(x []string, y []string) ([]string, []string)
- func DifferenceUInt(x []uint, y []uint) ([]uint, []uint)
- func DifferenceUInt32(x []uint32, y []uint32) ([]uint32, []uint32)
- func DifferenceUInt64(x []uint64, y []uint64) ([]uint64, []uint64)
- func Drop(in interface{}, n int) interface{}
- func DropBool(s []bool, n int) []bool
- func DropFloat32(s []float32, n int) []float32
- func DropFloat64(s []float64, n int) []float64
- func DropInt(s []int, n int) []int
- func DropInt32(s []int32, n int) []int32
- func DropInt64(s []int64, n int) []int64
- func DropString(s []string, n int) []string
- func DropUInt(s []uint, n uint) []uint
- func DropUInt32(s []uint32, n int) []uint32
- func DropUInt64(s []uint64, n int) []uint64
- func Equal(expected interface{}, actual interface{}) bool
- func Every(in interface{}, elements ...interface{}) bool
- func Fill(in interface{}, fillValue interface{}) (interface{}, error)
- func Filter(arr interface{}, predicate interface{}) interface{}
- func FilterBool(s []bool, cb func(s bool) bool) []bool
- func FilterFloat32(s []float32, cb func(s float32) bool) []float32
- func FilterFloat64(s []float64, cb func(s float64) bool) []float64
- func FilterInt(s []int, cb func(s int) bool) []int
- func FilterInt32(s []int32, cb func(s int32) bool) []int32
- func FilterInt64(s []int64, cb func(s int64) bool) []int64
- func FilterString(s []string, cb func(s string) bool) []string
- func FilterUInt(s []uint, cb func(s uint) bool) []uint
- func FilterUInt32(s []uint32, cb func(s uint32) bool) []uint32
- func FilterUInt64(s []uint64, cb func(s uint64) bool) []uint64
- func Find(arr interface{}, predicate interface{}) interface{}
- func FindFloat32(s []float32, cb func(s float32) bool) (float32, bool)
- func FindFloat64(s []float64, cb func(s float64) bool) (float64, bool)
- func FindInt(s []int, cb func(s int) bool) (int, bool)
- func FindInt32(s []int32, cb func(s int32) bool) (int32, bool)
- func FindInt64(s []int64, cb func(s int64) bool) (int64, bool)
- func FindKey(arr interface{}, predicate interface{}) (matchKey, matchEle interface{})
- func FindString(s []string, cb func(s string) bool) (string, bool)
- func FlatMap(arr interface{}, mapFunc interface{}) interface{}
- func Flatten(out interface{}) interface{}
- func FlattenDeep(out interface{}) interface{}
- func ForEach(arr interface{}, predicate interface{})
- func ForEachRight(arr interface{}, predicate interface{})
- func Get(out interface{}, path string, opts ...option) interface{}
- func GetOrElse(v interface{}, def interface{}) interface{}
- func Head(arr interface{}) interface{}
- func InBools(s []bool, v bool) bool
- func InFloat32s(s []float32, v float32) bool
- func InFloat64s(s []float64, v float64) bool
- func InInt32s(s []int32, v int32) bool
- func InInt64s(s []int64, v int64) bool
- func InInts(s []int, v int) bool
- func InStrings(s []string, v string) bool
- func InUInt32s(s []uint32, v uint32) bool
- func InUInt64s(s []uint64, v uint64) bool
- func InUInts(s []uint, v uint) bool
- func IndexOf(in interface{}, elem interface{}) int
- func IndexOfBool(a []bool, x bool) int
- func IndexOfFloat64(a []float64, x float64) int
- func IndexOfInt(a []int, x int) int
- func IndexOfInt32(a []int32, x int32) int
- func IndexOfInt64(a []int64, x int64) int
- func IndexOfString(a []string, x string) int
- func IndexOfUInt(a []uint, x uint) int
- func IndexOfUInt32(a []uint32, x uint32) int
- func IndexOfUInt64(a []uint64, x uint64) int
- func Initial(arr interface{}) interface{}
- func InnerJoin(lx, rx reflect.Value) reflect.Value
- func InnerJoinFloat32(lx, rx []float32) []float32
- func InnerJoinFloat64(lx, rx []float64) []float64
- func InnerJoinInt(lx, rx []int) []int
- func InnerJoinInt32(lx, rx []int32) []int32
- func InnerJoinInt64(lx, rx []int64) []int64
- func InnerJoinString(lx, rx []string) []string
- func Intersect(x interface{}, y interface{}) interface{}DEPRECATED
- func IntersectString(x []string, y []string) []string
- func IsCollection(in interface{}) bool
- func IsEmpty(obj interface{}) bool
- func IsEqual(expected interface{}, actual interface{}) bool
- func IsFunction(in interface{}, num ...int) bool
- func IsIteratee(in interface{}) bool
- func IsPredicate(in interface{}, inTypes ...reflect.Type) bool
- func IsType(expected interface{}, actual interface{}) bool
- func IsZero(obj interface{}) bool
- func Join(larr, rarr interface{}, fnc JoinFnc) interface{}
- func JoinFloat32(larr, rarr []float32, fnc JoinFloat32Fnc) []float32
- func JoinFloat64(larr, rarr []float64, fnc JoinFloat64Fnc) []float64
- func JoinInt(larr, rarr []int, fnc JoinIntFnc) []int
- func JoinInt32(larr, rarr []int32, fnc JoinInt32Fnc) []int32
- func JoinInt64(larr, rarr []int64, fnc JoinInt64Fnc) []int64
- func JoinString(larr, rarr []string, fnc JoinStringFnc) []string
- func Keys(out interface{}) interface{}
- func Last(arr interface{}) interface{}
- func LastIndexOf(in interface{}, elem interface{}) int
- func LastIndexOfBool(a []bool, x bool) int
- func LastIndexOfFloat32(a []float32, x float32) int
- func LastIndexOfFloat64(a []float64, x float64) int
- func LastIndexOfInt(a []int, x int) int
- func LastIndexOfInt32(a []int32, x int32) int
- func LastIndexOfInt64(a []int64, x int64) int
- func LastIndexOfString(a []string, x string) int
- func LastIndexOfUInt(a []uint, x uint) int
- func LastIndexOfUInt32(a []uint32, x uint32) int
- func LastIndexOfUInt64(a []uint64, x uint64) int
- func LeftJoin(lx, rx reflect.Value) reflect.Value
- func LeftJoinFloat32(lx, rx []float32) []float32
- func LeftJoinFloat64(lx, rx []float64) []float64
- func LeftJoinInt(lx, rx []int) []int
- func LeftJoinInt32(lx, rx []int32) []int32
- func LeftJoinInt64(lx, rx []int64) []int64
- func LeftJoinString(lx, rx []string) []string
- func Map(arr interface{}, mapFunc interface{}) interface{}
- func MaxFloat32(i []float32) float32
- func MaxFloat64(i []float64) float64
- func MaxInt(i []int) int
- func MaxInt16(i []int16) int16
- func MaxInt32(i []int32) int32
- func MaxInt64(i []int64) int64
- func MaxInt8(i []int8) int8
- func MaxString(i []string) string
- func MinFloat32(i []float32) float32
- func MinFloat64(i []float64) float64
- func MinInt(i []int) int
- func MinInt16(i []int16) int16
- func MinInt32(i []int32) int32
- func MinInt64(i []int64) int64
- func MinInt8(i []int8) int8
- func MinString(i []string) string
- func MustSet(in interface{}, val interface{}, path string)
- func NextPermutation(nums []int) error
- func NotEmpty(obj interface{}) bool
- func NotEqual(expected interface{}, actual interface{}) bool
- func OuterJoin(lx, rx reflect.Value) reflect.Value
- func OuterJoinFloat32(lx, rx []float32) []float32
- func OuterJoinFloat64(lx, rx []float64) []float64
- func OuterJoinInt(lx, rx []int) []int
- func OuterJoinInt32(lx, rx []int32) []int32
- func OuterJoinInt64(lx, rx []int64) []int64
- func OuterJoinString(lx, rx []string) []string
- func Product(arr interface{}) float64
- func Prune(in interface{}, paths []string) (interface{}, error)
- func PruneByTag(in interface{}, paths []string, tag string) (interface{}, error)
- func PtrOf(itf interface{}) interface{}
- func RandomInt(min, max int) int
- func RandomString(n int, allowedChars ...[]rune) string
- func Reduce(arr, reduceFunc, acc interface{}) interface{}
- func Reverse(in interface{}) interface{}
- func ReverseBools(s []bool) []bool
- func ReverseFloat32(s []float32) []float32
- func ReverseFloat64(s []float64) []float64
- func ReverseInt(s []int) []int
- func ReverseInt32(s []int32) []int32
- func ReverseInt64(s []int64) []int64
- func ReverseString(s string) string
- func ReverseStrings(s []string) []string
- func ReverseUInt(s []uint) []uint
- func ReverseUInt32(s []uint32) []uint32
- func ReverseUInt64(s []uint64) []uint64
- func RightJoin(lx, rx reflect.Value) reflect.Value
- func RightJoinFloat32(lx, rx []float32) []float32
- func RightJoinFloat64(lx, rx []float64) []float64
- func RightJoinInt(lx, rx []int) []int
- func RightJoinInt32(lx, rx []int32) []int32
- func RightJoinInt64(lx, rx []int64) []int64
- func RightJoinString(lx, rx []string) []string
- func Set(in interface{}, val interface{}, path string) error
- func Shard(str string, width int, depth int, restOnly bool) []string
- func ShortIf(condition bool, a interface{}, b interface{}) interface{}
- func Shuffle(in interface{}) interface{}
- func ShuffleBool(a []bool) []bool
- func ShuffleFloat32(a []float32) []float32
- func ShuffleFloat64(a []float64) []float64
- func ShuffleInt(a []int) []int
- func ShuffleInt32(a []int32) []int32
- func ShuffleInt64(a []int64) []int64
- func ShuffleString(a []string) []string
- func ShuffleUInt(a []uint) []uint
- func ShuffleUInt32(a []uint32) []uint32
- func ShuffleUInt64(a []uint64) []uint64
- func SliceOf(in interface{}) interface{}
- func Some(in interface{}, elements ...interface{}) bool
- func StringerJoin(elems []interface{ ... }, sep string) string
- func Subset(x interface{}, y interface{}) bool
- func Subtract(x interface{}, y interface{}) interface{}
- func SubtractString(x []string, y []string) []string
- func Sum(arr interface{}) float64
- func SumFloat32(s []float32) (sum float32)
- func SumFloat64(s []float64) (sum float64)
- func SumInt(s []int) (sum int)
- func SumInt32(s []int32) (sum int32)
- func SumInt64(s []int64) (sum int64)
- func SumUInt(s []uint) (sum uint)
- func SumUInt32(s []uint32) (sum uint32)
- func SumUInt64(s []uint64) (sum uint64)
- func Tail(arr interface{}) interface{}
- func ToFloat64(x interface{}) (float64, bool)
- func ToMap(in interface{}, pivot string) interface{}
- func ToSet(in interface{}) interface{}
- func Union(collections ...interface{}) interface{}
- func UnionStringMap(x ...map[string]string) map[string]string
- func Uniq(in interface{}) interface{}
- func UniqBool(a []bool) []bool
- func UniqBy(in interface{}, mapFunc interface{}) interface{}
- func UniqFloat32(a []float32) []float32
- func UniqFloat64(a []float64) []float64
- func UniqInt(a []int) []int
- func UniqInt32(a []int32) []int32
- func UniqInt64(a []int64) []int64
- func UniqString(a []string) []string
- func UniqUInt(a []uint) []uint
- func UniqUInt32(a []uint32) []uint32
- func UniqUInt64(a []uint64) []uint64
- func Values(out interface{}) interface{}
- func WithAllowZero() func(*options)
- func Without(in interface{}, values ...interface{}) interface{}
- func ZeroOf(in interface{}) interface{}