Documentation
¶
Overview ¶
file from https://github.com/beego/beego/blob/develop/core/utils/slice.go
Index ¶
- Variables
- func Chunk(slice []interface{}, size int) (chunkSlice [][]interface{})
- func Diff(slice1, slice2 []interface{}) (diffSlice []interface{})
- func Error(text string) error
- func Errorf(format string, a ...interface{}) error
- func Filter(slice []interface{}, a func(interface{}) bool) (filterSlice []interface{})
- func InInterface(v interface{}, sl []interface{}) bool
- func Intersect(slice1, slice2 []interface{}) (diffSlice []interface{})
- func Merge(slice1, slice2 []interface{}) (c []interface{})
- func Pad(slice []interface{}, size int, val interface{}) []interface{}
- func Rand(a []interface{}) (b interface{})
- func RandList(min, max int) []int
- func Range(start, end, step int64) (intSlice []int64)
- func Reduce(slice []interface{}, a func(interface{}) interface{}) (destSlice []interface{})
- func Shuffle(slice []interface{}) []interface{}
- func Sum(intslice []int64) (sum int64)
- func Unique(slice []interface{}) (uniqueSlice []interface{})
- type WaitGroup
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Compress = &compress{} Crypto = &crypto{} File = &file{} Reflect = &reflection{} Timer = &timer{} Strings = &strings{} Json = &json{} Net = &net{} Slice = &slice{} )
Functions ¶
func Chunk ¶
func Chunk(slice []interface{}, size int) (chunkSlice [][]interface{})
Chunk separates one slice to some sized slice.
func Diff ¶
func Diff(slice1, slice2 []interface{}) (diffSlice []interface{})
Diff returns diff slice of slice1 - slice2.
func Filter ¶
func Filter(slice []interface{}, a func(interface{}) bool) (filterSlice []interface{})
Filter generates a new slice after filter function.
func InInterface ¶
func InInterface(v interface{}, sl []interface{}) bool
InInterface checks given interface in interface slice.
func Intersect ¶
func Intersect(slice1, slice2 []interface{}) (diffSlice []interface{})
Intersect returns slice that are present in all the slice1 and slice2.
func Merge ¶
func Merge(slice1, slice2 []interface{}) (c []interface{})
Merge merges interface slices to one slice.
func Pad ¶
func Pad(slice []interface{}, size int, val interface{}) []interface{}
Pad prepends size number of val into slice.
Types ¶
Click to show internal directories.
Click to hide internal directories.