Documentation
¶
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 Uniq(in interface{}) interface{}
- func UniqBool(a []bool) []bool
- 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{}
- type Builder
- type JoinFloat32Fnc
- type JoinFloat64Fnc
- type JoinFnc
- type JoinInt32Fnc
- type JoinInt64Fnc
- type JoinIntFnc
- type JoinStringFnc
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(objs ...interface{}) bool
All returns true if all elements of the iterable are not empty (or if the iterable is empty)
func AllPredicates ¶
func AllPredicates(value interface{}, predicates interface{}) bool
AllPredicates gets a value and a series of predicates, and return true if all of the predicates are true.
func Any ¶
func Any(objs ...interface{}) bool
Any returns true if any element of the iterable is not empty. If the iterable is empty, return False.
func AnyPredicates ¶
func AnyPredicates(value interface{}, predicates interface{}) bool
AnyPredicates gets a value and a series of predicates, and return true if at least one of the predicates is true.
func Chunk ¶
func Chunk(arr interface{}, size int) interface{}
Chunk creates an array of elements split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func ChunkFloat64s ¶
ChunkFloat64s creates an array of float64s split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func ChunkInt32s ¶
ChunkInt32s creates an array of int32s split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func ChunkInt64s ¶
ChunkInt64s creates an array of int64s split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func ChunkInts ¶
ChunkInts creates an array of ints split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func ChunkStrings ¶
ChunkStrings creates an array of strings split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.
func Compact ¶
func Compact(value interface{}) interface{}
Compact creates a slice with all empty/zero values removed.
func Contains ¶
func Contains(in interface{}, elem interface{}) bool
Contains returns true if an element is present in a iteratee.
func ContainsBool ¶
ContainsBool returns true if a boolean is present in a iteratee.
func ContainsFloat32 ¶
ContainsFloat32 returns true if a float32 is present in a iteratee.
func ContainsFloat64 ¶
ContainsFloat64 returns true if a float64 is present in a iteratee.
func ContainsInt ¶
ContainsInt returns true if an int is present in a iteratee.
func ContainsInt32 ¶
ContainsInt32 returns true if an int32 is present in a iteratee.
func ContainsInt64 ¶
ContainsInt64 returns true if an int64 is present in a iteratee.
func ContainsString ¶
ContainsString returns true if a string is present in a iteratee.
func ContainsUInt ¶
ContainsUInt returns true if an uint is present in a iteratee.
func ContainsUInt32 ¶
ContainsUInt32 returns true if an uint32 is present in a iteratee.
func ContainsUInt64 ¶
ContainsUInt64 returns true if an uint64 is present in a iteratee.
func ConvertSlice ¶
func ConvertSlice(in interface{}, out interface{})
ConvertSlice converts a slice type to another, a perfect example would be to convert a slice of struct to a slice of interface.
func Difference ¶
func Difference(x interface{}, y interface{}) (interface{}, interface{})
Difference returns the difference between two collections.
func DifferenceInt ¶
DifferenceInt returns the difference between two collections of ints.
func DifferenceInt32 ¶
DifferenceInt32 returns the difference between two collections of ints32.
func DifferenceInt64 ¶
DifferenceInt64 returns the difference between two collections of int64s.
func DifferenceString ¶
DifferenceString returns the difference between two collections of strings.
func DifferenceUInt ¶
DifferenceUInt returns the difference between two collections of uints.
func DifferenceUInt32 ¶
DifferenceUInt32 returns the difference between two collections of uints32.
func DifferenceUInt64 ¶
DifferenceUInt64 returns the difference between two collections of uints64.
func Drop ¶
func Drop(in interface{}, n int) interface{}
Drop creates an array/slice with `n` elements dropped from the beginning.
func DropFloat32 ¶
DropFloat32 creates a slice with `n` float32s dropped from the beginning.
func DropFloat64 ¶
DropFloat64 creates a slice with `n` float64s dropped from the beginning.
func DropString ¶
DropString creates a slice with `n` strings dropped from the beginning.
func DropUInt32 ¶
DropUInt32 creates a slice with `n` int32s dropped from the beginning.
func DropUInt64 ¶
DropUInt64 creates a slice with `n` int64s dropped from the beginning.
func Equal ¶
func Equal(expected interface{}, actual interface{}) bool
Equal returns if the two objects are equal
func Every ¶
func Every(in interface{}, elements ...interface{}) bool
Every returns true if every element is present in a iteratee.
func Fill ¶
func Fill(in interface{}, fillValue interface{}) (interface{}, error)
Fill fills elements of array with value
func Filter ¶
func Filter(arr interface{}, predicate interface{}) interface{}
Filter iterates over elements of collection, returning an array of all elements predicate returns truthy for.
func FilterBool ¶
FilterBool iterates over a collection of bool, returning an array of all bool elements predicate returns truthy for.
func FilterFloat32 ¶
FilterFloat32 iterates over a collection of float32, returning an array of all float32 elements predicate returns truthy for.
func FilterFloat64 ¶
FilterFloat64 iterates over a collection of float64, returning an array of all float64 elements predicate returns truthy for.
func FilterInt ¶
FilterInt iterates over a collection of int, returning an array of all int elements predicate returns truthy for.
func FilterInt32 ¶
FilterInt32 iterates over a collection of int32, returning an array of all int32 elements predicate returns truthy for.
func FilterInt64 ¶
FilterInt64 iterates over a collection of int64, returning an array of all int64 elements predicate returns truthy for.
func FilterString ¶
FilterString iterates over a collection of string, returning an array of all string elements predicate returns truthy for.
func FilterUInt ¶
FilterUInt iterates over a collection of uint, returning an array of all uint elements predicate returns truthy for.
func FilterUInt32 ¶
FilterUInt32 iterates over a collection of uint32, returning an array of all uint32 elements predicate returns truthy for.
func FilterUInt64 ¶
FilterUInt64 iterates over a collection of uint64, returning an array of all uint64 elements predicate returns truthy for.
func Find ¶
func Find(arr interface{}, predicate interface{}) interface{}
Find iterates over elements of collection, returning the first element predicate returns truthy for.
func FindFloat32 ¶
FindFloat32 iterates over a collection of float32, returning the first float32 element predicate returns truthy for.
func FindFloat64 ¶
FindFloat64 iterates over a collection of float64, returning an array of all float64 elements predicate returns truthy for.
func FindInt ¶
FindInt iterates over a collection of int, returning the first int element predicate returns truthy for.
func FindInt32 ¶
FindInt32 iterates over a collection of int32, returning the first int32 element predicate returns truthy for.
func FindInt64 ¶
FindInt64 iterates over a collection of int64, returning the first int64 element predicate returns truthy for.
func FindKey ¶
func FindKey(arr interface{}, predicate interface{}) (matchKey, matchEle interface{})
Find iterates over elements of collection, returning the first element of an array and random of a map which predicate returns truthy for.
func FindString ¶
FindString iterates over a collection of string, returning the first string element predicate returns truthy for.
func FlatMap ¶
func FlatMap(arr interface{}, mapFunc interface{}) interface{}
FlatMap manipulates an iteratee and transforms it to a flattened collection of another type.
func FlattenDeep ¶
func FlattenDeep(out interface{}) interface{}
FlattenDeep recursively flattens array.
func ForEach ¶
func ForEach(arr interface{}, predicate interface{})
ForEach iterates over elements of collection and invokes iteratee for each element.
func ForEachRight ¶
func ForEachRight(arr interface{}, predicate interface{})
ForEachRight iterates over elements of collection from the right and invokes iteratee for each element.
func Get ¶
func Get(out interface{}, path string, opts ...option) interface{}
Get retrieves the value from given path, retriever can be modified with available RetrieverOptions
func GetOrElse ¶
func GetOrElse(v interface{}, def interface{}) interface{}
GetOrElse retrieves the value of the pointer or default.
func InBools ¶
InBools is an alias of ContainsBool, returns true if a bool is present in a iteratee.
func InFloat32s ¶
InFloat32s is an alias of ContainsFloat32, returns true if a float32 is present in a iteratee.
func InFloat64s ¶
InFloat64s is an alias of ContainsFloat64, returns true if a float64 is present in a iteratee.
func InInt32s ¶
InInt32s is an alias of ContainsInt32, returns true if an int32 is present in a iteratee.
func InInt64s ¶
InInt64s is an alias of ContainsInt64, returns true if an int64 is present in a iteratee.
func InStrings ¶
InStrings is an alias of ContainsString, returns true if a string is present in a iteratee.
func InUInt32s ¶
InUInt32s is an alias of ContainsUInt32, returns true if an uint32 is present in a iteratee.
func InUInt64s ¶
InUInt64s is an alias of ContainsUInt64, returns true if an uint64 is present in a iteratee.
func InUInts ¶
InUInts is an alias of ContainsUInt, returns true if an uint is present in a iteratee.
func IndexOf ¶
func IndexOf(in interface{}, elem interface{}) int
IndexOf gets the index at which the first occurrence of value is found in array or return -1 if the value cannot be found
func IndexOfBool ¶
IndexOfBool gets the index at which the first occurrence of a bool value is found in array or return -1 if the value cannot be found
func IndexOfFloat64 ¶
IndexOfFloat64 gets the index at which the first occurrence of an float64 value is found in array or return -1 if the value cannot be found
func IndexOfInt ¶
IndexOfInt gets the index at which the first occurrence of an int value is found in array or return -1 if the value cannot be found
func IndexOfInt32 ¶
IndexOfInt32 gets the index at which the first occurrence of an int32 value is found in array or return -1 if the value cannot be found
func IndexOfInt64 ¶
IndexOfInt64 gets the index at which the first occurrence of an int64 value is found in array or return -1 if the value cannot be found
func IndexOfString ¶
IndexOfString gets the index at which the first occurrence of a string value is found in array or return -1 if the value cannot be found
func IndexOfUInt ¶
IndexOfUInt gets the index at which the first occurrence of an uint value is found in array or return -1 if the value cannot be found
func IndexOfUInt32 ¶
IndexOfUInt32 gets the index at which the first occurrence of an uint32 value is found in array or return -1 if the value cannot be found
func IndexOfUInt64 ¶
IndexOfUInt64 gets the index at which the first occurrence of an uint64 value is found in array or return -1 if the value cannot be found
func Initial ¶
func Initial(arr interface{}) interface{}
Initial gets all but the last element of array.
func InnerJoinFloat32 ¶
InnerJoinFloat32 finds and returns matching data from two float32 collections.
func InnerJoinFloat64 ¶
InnerJoinFloat64 finds and returns matching data from two float64 collections.
func InnerJoinInt ¶
InnerJoinInt finds and returns matching data from two int collections.
func InnerJoinInt32 ¶
InnerJoinInt32 finds and returns matching data from two int32 collections.
func InnerJoinInt64 ¶
InnerJoinInt64 finds and returns matching data from two int64 collections.
func InnerJoinString ¶
InnerJoinString finds and returns matching data from two string collections.
func Intersect
deprecated
func Intersect(x interface{}, y interface{}) interface{}
Intersect returns the intersection between two collections.
Deprecated: use Join(x, y, InnerJoin) instead of Intersect, InnerJoin implements deduplication mechanism, so verify your code behaviour before using it
func IntersectString ¶
Intersect / IntersectString 返回两个字符串切片之间的交集 Example: ``` str.Intersect(["1", "2", "3"], ["3", "4", "5"]) // ["3"] ```
func IsCollection ¶
func IsCollection(in interface{}) bool
IsCollection returns if the argument is a collection.
func IsEmpty ¶
func IsEmpty(obj interface{}) bool
IsEmpty returns if the object is considered as empty or not.
func IsEqual ¶
func IsEqual(expected interface{}, actual interface{}) bool
IsEqual returns if the two objects are equal
func IsFunction ¶
IsFunction returns if the argument is a function.
func IsIteratee ¶
func IsIteratee(in interface{}) bool
IsIteratee returns if the argument is an iteratee.
func IsPredicate ¶
IsPredicate returns if the argument is a predicate function.
func IsType ¶
func IsType(expected interface{}, actual interface{}) bool
IsType returns if the two objects are in the same type
func IsZero ¶
func IsZero(obj interface{}) bool
IsZero returns if the object is considered as zero value
func Join ¶
func Join(larr, rarr interface{}, fnc JoinFnc) interface{}
Join combines two collections using the given join method.
func JoinFloat32 ¶
func JoinFloat32(larr, rarr []float32, fnc JoinFloat32Fnc) []float32
JoinFloat32 combines two float32 collections using the given join method.
func JoinFloat64 ¶
func JoinFloat64(larr, rarr []float64, fnc JoinFloat64Fnc) []float64
JoinFloat64 combines two float64 collections using the given join method.
func JoinInt ¶
func JoinInt(larr, rarr []int, fnc JoinIntFnc) []int
JoinInt combines two int collections using the given join method.
func JoinInt32 ¶
func JoinInt32(larr, rarr []int32, fnc JoinInt32Fnc) []int32
JoinInt32 combines two int32 collections using the given join method.
func JoinInt64 ¶
func JoinInt64(larr, rarr []int64, fnc JoinInt64Fnc) []int64
JoinInt64 combines two int64 collections using the given join method.
func JoinString ¶
func JoinString(larr, rarr []string, fnc JoinStringFnc) []string
JoinString combines two string collections using the given join method.
func Keys ¶
func Keys(out interface{}) interface{}
Keys creates an array of the own enumerable map keys or struct field names.
func LastIndexOf ¶
func LastIndexOf(in interface{}, elem interface{}) int
LastIndexOf gets the index at which the last occurrence of value is found in array or return -1 if the value cannot be found
func LastIndexOfBool ¶
LastIndexOfBool gets the index at which the first occurrence of a bool value is found in array or return -1 if the value cannot be found
func LastIndexOfFloat32 ¶
LastIndexOfFloat32 gets the index at which the first occurrence of an float32 value is found in array or return -1 if the value cannot be found
func LastIndexOfFloat64 ¶
LastIndexOfFloat64 gets the index at which the first occurrence of an float64 value is found in array or return -1 if the value cannot be found
func LastIndexOfInt ¶
LastIndexOfInt gets the index at which the first occurrence of an int value is found in array or return -1 if the value cannot be found
func LastIndexOfInt32 ¶
LastIndexOfInt32 gets the index at which the first occurrence of an int32 value is found in array or return -1 if the value cannot be found
func LastIndexOfInt64 ¶
LastIndexOfInt64 gets the index at which the first occurrence of an int64 value is found in array or return -1 if the value cannot be found
func LastIndexOfString ¶
LastIndexOfString gets the index at which the first occurrence of a string value is found in array or return -1 if the value cannot be found
func LastIndexOfUInt ¶
LastIndexOfUInt gets the index at which the first occurrence of an uint value is found in array or return -1 if the value cannot be found
func LastIndexOfUInt32 ¶
LastIndexOfUInt32 gets the index at which the first occurrence of an uint32 value is found in array or return -1 if the value cannot be found
func LastIndexOfUInt64 ¶
LastIndexOfUInt64 gets the index at which the first occurrence of an uint64 value is found in array or return -1 if the value cannot be found
func LeftJoinFloat32 ¶
LeftJoinFloat32 finds and returns dissimilar data from the first float32 collection (left).
func LeftJoinFloat64 ¶
LeftJoinFloat64 finds and returns dissimilar data from the first float64 collection (left).
func LeftJoinInt ¶
LeftJoinInt finds and returns dissimilar data from the first int collection (left).
func LeftJoinInt32 ¶
LeftJoinInt32 finds and returns dissimilar data from the first int32 collection (left).
func LeftJoinInt64 ¶
LeftJoinInt64 finds and returns dissimilar data from the first int64 collection (left).
func LeftJoinString ¶
LeftJoinString finds and returns dissimilar data from the first string collection (left).
func Map ¶
func Map(arr interface{}, mapFunc interface{}) interface{}
Map manipulates an iteratee and transforms it to another type.
func MaxFloat32 ¶
MaxFloat32 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []float32 It returns float32
func MaxFloat64 ¶
MaxFloat64 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []float64 It returns float64
func MaxInt ¶
MaxInt validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []int It returns int
func MaxInt16 ¶
MaxInt16 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []int16 It returns int16
func MaxInt32 ¶
MaxInt32 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []int32 It returns int32
func MaxInt64 ¶
MaxInt64 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []int64 It returns int64
func MaxInt8 ¶
MaxInt8 validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []int8 It returns int8
func MaxString ¶
MaxString validates the input, compares the elements and returns the maximum element in an array/slice. It accepts []string It returns string
func MinFloat32 ¶
MinFloat32 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []float32 It returns float32
func MinFloat64 ¶
MinFloat64 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []float64 It returns float64
func MinInt ¶
MinInt validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []int It returns int
func MinInt16 ¶
MinInt16 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []int16 It returns int16
func MinInt32 ¶
MinInt32 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []int32 It returns int32
func MinInt64 ¶
MinInt64 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []int64 It returns int64
func MinInt8 ¶
MinInt8 validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []int8 It returns int8
func MinString ¶
MinString validates the input, compares the elements and returns the minimum element in an array/slice. It accepts []string It returns string
func MustSet ¶
func MustSet(in interface{}, val interface{}, path string)
MustSet is functionally the same as Set. It panics instead of returning error. It is safe to use if the in value is well formed.
func NextPermutation ¶
NextPermutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
func NotEmpty ¶
func NotEmpty(obj interface{}) bool
NotEmpty returns if the object is considered as non-empty or not.
func NotEqual ¶
func NotEqual(expected interface{}, actual interface{}) bool
NotEqual returns if the two objects are not equal
func OuterJoinFloat32 ¶
OuterJoinFloat32 finds and returns dissimilar data from two float32 collections.
func OuterJoinFloat64 ¶
OuterJoinFloat64 finds and returns dissimilar data from two float64 collections.
func OuterJoinInt ¶
OuterJoinInt finds and returns dissimilar data from two int collections.
func OuterJoinInt32 ¶
OuterJoinInt32 finds and returns dissimilar data from two int32 collections.
func OuterJoinInt64 ¶
OuterJoinInt64 finds and returns dissimilar data from two int64 collections.
func OuterJoinString ¶
OuterJoinString finds and returns dissimilar data from two string collections.
func Product ¶
func Product(arr interface{}) float64
Product computes the product of the values in array.
func Prune ¶
Prune returns a copy of "in" that only contains fields in "paths" which are looked up using struct field name. For lookup paths by field tag instead, use funk.PruneByTag()
func PruneByTag ¶
pruneByTag returns a copy of "in" that only contains fields in "paths" which are looked up using struct field Tag "tag".
func PtrOf ¶
func PtrOf(itf interface{}) interface{}
PtrOf makes a copy of the given interface and returns a pointer.
func RandomString ¶
RandomString returns a random string with a fixed length
func Reduce ¶
func Reduce(arr, reduceFunc, acc interface{}) interface{}
Reduce takes a collection and reduces it to a single value using a reduction function (or a valid symbol) and an accumulator value.
func Reverse ¶
func Reverse(in interface{}) interface{}
Reverse transforms an array the first element will become the last, the second element will become the second to last, etc.
func ReverseFloat32 ¶
ReverseFloat32 reverses an array of float32
func ReverseFloat64 ¶
ReverseFloat64 reverses an array of float64
func ReverseStrings ¶
ReverseStrings reverses an array of string
func ReverseUInt32 ¶
ReverseUInt32 reverses an array of uint32
func ReverseUInt64 ¶
ReverseUInt64 reverses an array of uint64
func RightJoinFloat32 ¶
LeftJoinFloat32 finds and returns dissimilar data from the second float32 collection (right).
func RightJoinFloat64 ¶
LeftJoinFloat64 finds and returns dissimilar data from the second float64 collection (right).
func RightJoinInt ¶
LeftJoinInt finds and returns dissimilar data from the second int collection (right).
func RightJoinInt32 ¶
LeftJoinInt32 finds and returns dissimilar data from the second int32 collection (right).
func RightJoinInt64 ¶
LeftJoinInt64 finds and returns dissimilar data from the second int64 collection (right).
func RightJoinString ¶
LeftJoinString finds and returns dissimilar data from the second string collection (right).
func Set ¶
Set assigns in at path with value val. i.e. in.path = val in accepts types of ptr to struct, ptr to variable, slice and ptr to slice. Along the path, interface{} is supported and nil ptr is initialized to ptr to zero value of the type until the variable to be set is obtained. It returns errors when encountering along the path unknown types, uninitialized interface{} or interface{} containing struct directly (not ptr to struct).
Slice is resolved the same way in funk.Get(), by traversing each element of the slice, so that each element of the slice's corresponding field are going to be set to the same provided val. If Set is called on slice with empty path "", it behaves the same as funk.Fill()
If in is well formed, i.e. do not expect above descripted errors to happen, funk.MustSet() is a short hand wrapper to discard error return
func ShuffleBool ¶
ShuffleBool creates an array of bool shuffled values using Fisher–Yates algorithm
func ShuffleFloat32 ¶
ShuffleFloat32 creates an array of float32 shuffled values using Fisher–Yates algorithm
func ShuffleFloat64 ¶
ShuffleFloat64 creates an array of float64 shuffled values using Fisher–Yates algorithm
func ShuffleInt ¶
ShuffleInt creates an array of int shuffled values using Fisher–Yates algorithm
func ShuffleInt32 ¶
ShuffleInt32 creates an array of int32 shuffled values using Fisher–Yates algorithm
func ShuffleInt64 ¶
ShuffleInt64 creates an array of int64 shuffled values using Fisher–Yates algorithm
func ShuffleString ¶
ShuffleString creates an array of string shuffled values using Fisher–Yates algorithm
func ShuffleUInt ¶
ShuffleUInt creates an array of int shuffled values using Fisher–Yates algorithm
func ShuffleUInt32 ¶
ShuffleUInt32 creates an array of uint32 shuffled values using Fisher–Yates algorithm
func ShuffleUInt64 ¶
ShuffleUInt64 creates an array of uint64 shuffled values using Fisher–Yates algorithm
func SliceOf ¶
func SliceOf(in interface{}) interface{}
SliceOf returns a slice which contains the element.
func Some ¶
func Some(in interface{}, elements ...interface{}) bool
Some returns true if atleast one element is present in an iteratee.
func StringerJoin ¶
StringerJoin joins an array of elements which implement the `String() string` function. Direct copy of strings.Join() with a few tweaks.
func Subset ¶
func Subset(x interface{}, y interface{}) bool
Subset returns true if collection x is a subset of y.
func Subtract ¶
func Subtract(x interface{}, y interface{}) interface{}
Subtract returns the subtraction between two collections.
func SubtractString ¶
Subtract 返回两个字符串切片的差集 Example: ``` str.Subtract(["1", "2", "3"], ["3", "4", "5"]) // ["1", "2"] ```
func SumFloat32 ¶
SumFloat32 sums a float32 iteratee and returns the sum of all elements
func SumFloat64 ¶
SumFloat64 sums a float64 iteratee and returns the sum of all elements
func ToMap ¶
func ToMap(in interface{}, pivot string) interface{}
ToMap transforms a slice of instances to a Map. []*Foo => Map<int, *Foo>
func UniqFloat32 ¶
UniqFloat32 creates an array of float32 with unique values.
func UniqFloat64 ¶
UniqFloat64 creates an array of float64 with unique values.
func UniqString ¶
UniqString creates an array of string with unique values.
func UniqUInt32 ¶
UniqUInt32 creates an array of uint32 with unique values.
func UniqUInt64 ¶
UniqUInt64 creates an array of uint64 with unique values.
func Values ¶
func Values(out interface{}) interface{}
Values creates an array of the own enumerable map values or struct field values.
Types ¶
type Builder ¶
type Builder interface { Chunk(size int) Builder Compact() Builder Drop(n int) Builder Filter(predicate interface{}) Builder Flatten() Builder FlattenDeep() Builder Initial() Builder Intersect(y interface{}) Builder Join(rarr interface{}, fnc JoinFnc) Builder Map(mapFunc interface{}) Builder FlatMap(mapFunc interface{}) Builder Reverse() Builder Shuffle() Builder Tail() Builder Uniq() Builder Without(values ...interface{}) Builder All() bool Any() bool Contains(elem interface{}) bool Every(elements ...interface{}) bool Find(predicate interface{}) interface{} ForEach(predicate interface{}) ForEachRight(predicate interface{}) Head() interface{} Keys() interface{} IndexOf(elem interface{}) int IsEmpty() bool Last() interface{} LastIndexOf(elem interface{}) int NotEmpty() bool Product() float64 Reduce(reduceFunc, acc interface{}) interface{} Sum() float64 Type() reflect.Type Value() interface{} Values() interface{} }
Builder contains all tools which can be chained.
func Chain ¶
func Chain(v interface{}) Builder
Chain creates a simple new go-funk.Builder from a collection. Each method call generate a new builder containing the previous result.
func LazyChain ¶
func LazyChain(v interface{}) Builder
LazyChain creates a lazy go-funk.Builder from a collection. Each method call generate a new builder containing a method generating the previous value. With that, all data are only generated when we call a tailling method like All or Find.
func LazyChainWith ¶
func LazyChainWith(generator func() interface{}) Builder
LazyChainWith creates a lazy go-funk.Builder from a generator. Like LazyChain, each method call generate a new builder containing a method generating the previous value. But, instead of using a collection, it takes a generator which can generate values. With LazyChainWith, to can create a generic pipeline of collection transformation and, throw the generator, sending different collection.
type JoinFloat32Fnc ¶
type JoinFloat64Fnc ¶
type JoinInt32Fnc ¶
type JoinInt64Fnc ¶
type JoinIntFnc ¶
type JoinStringFnc ¶
Source Files
¶
- assign.go
- builder.go
- chain_builder.go
- compact.go
- fill.go
- helpers.go
- intersection.go
- join.go
- join_primitives.go
- lazy_builder.go
- map.go
- max.go
- min.go
- operation.go
- options.go
- permutation.go
- predicate.go
- presence.go
- reduce.go
- retrieve.go
- scan.go
- short_if.go
- subset.go
- subtraction.go
- transform.go
- typesafe.go
- utils.go
- without.go
- zip.go