Documentation ¶
Index ¶
- Constants
- func Chunk[T any](arr []T, size int) [][]T
- func Comb[T any](arr []T, m int) (r [][]T)
- func Copy[T any](a []T, l ...int) []T
- func Decompress[T any](a [][]T) (r []T)
- func DecompressBy[T, R any](a [][]T, fn func(T) (R, bool)) (r []R)
- func Delete[T any](a *[]T, index int)
- func Diff[T comparable](a []T, b ...[]T) (r []T)
- func DiffByFn[T any](a []T, fn func(i, j T) bool, b ...[]T) (r []T)
- func DiffNewByFn[T, V any](a []T, fn func(i, j T) bool, fnV func(T) V, b ...[]T) (r []V)
- func Fill[T any](start, len int, v T) []T
- func Filter[T any](arr []T, fn func(T, int) bool) []T
- func FilterAndMap[N any, T any](arr []T, fn func(T) (N, bool)) (r []N)
- func FilterAndMaps[N any, T any](arr []T, fn func(int, T) (N, bool)) (r []N)
- func FilterAndToMap[K comparable, V, T any](arr []T, fn func(T, int) (K, V, bool)) map[K]V
- func Filters[T any](arr []T, fn func(T) bool) []T
- func ForEach[T any](a []T, fn func(i int, v T))
- func GroupBy[K comparable, T, V any](a []T, fn func(T) (K, V)) map[K][]V
- func IndexOf[T comparable](a []T, v T) int
- func IndexOfBy[T any](a []T, fn func(T) bool) int
- func Intersect[T comparable](a []T, b ...[]T) (r []T)
- func IntersectByFn[T any](a []T, fn func(i, j T) bool, b ...[]T) (r []T)
- func IntersectNewByFn[T, V any](a []T, fn func(i, j T) bool, fnV func(T) V, b ...[]T) (r []V)
- func IsContained[T comparable](arr []T, a T) bool
- func IsContainedByFn[T any](a []T, e T, fn func(i, j T) bool) bool
- func Map[T, R any](arr []T, fn func(T) R) []R
- func Pad[T any](a []T, length int, v T) []T
- func Pagination[T any](arr []T, page, pageSize int) []T
- func Pop[T any](a *[]T) T
- func Push[T any](a *[]T, e ...T)
- func Rand[T any](a []T) (int, T)
- func RandPop[T any](a *[]T) (T, int)
- func Reduce[R, T any](arr []T, fn func(T, R) R, r R) R
- func Replace[T any](a []T, offset int, replacement []T)
- func Reverse[T any](arr []T) []T
- func ReversePagination[T any](arr []T, page, pageSize int) []T
- func ReverseReduce[R, T any](a []T, fn func(T, R) R, r R) R
- func ReverseSelf[T any](arr []T) []T
- func SearchFirst[T any](arr []T, fn func(T) bool) (int, T)
- func SearchLast[T any](arr []T, fn func(T) bool) (int, T)
- func Shift[T any](a *[]T) (T, int)
- func Shuffle[T any](a *[]T)
- func SimpleSort[T any, O constraints.Ordered](a []T, order string, fn func(t T) O)
- func SimpleSorts[T constraints.Ordered](a []T, order string)
- func SimpleToMap[K comparable, V any](arr []V, fn func(V) K) map[K]V
- func Slice[T any](arr []T, offset, length int) (r []T)
- func Sort[T any](arr []T, fn func(i, j T) bool)
- func Sorts[T constraints.Ordered](a []T, order string)
- func SortsNew[T constraints.Ordered](a []T, order string) []T
- func Splice[T any](a *[]T, offset, length int, replacement []T) []T
- func StableSort[T any](arr []T, fn func(i, j T) bool)
- func ToAnySlice[T any](a []T) []any
- func ToMap[K comparable, V, T any](arr []V, fn func(V) (K, T), isCoverPrev bool) map[K]T
- func Unique[T comparable](a ...[]T) (r []T)
- func UniqueByFn[T any](fn func(T, T) bool, a ...[]T) (r []T)
- func UniqueNewByFn[T, V any](fn func(T, T) bool, fnVal func(T) V, a ...[]T) (r []V)
- func Unshift[T any](a *[]T, e ...T)
- func Walk[T any](arr []T, fn func(*T))
Constants ¶
View Source
const ( ASC = "asc" DESC = "desc" )
Variables ¶
This section is empty.
Functions ¶
func Decompress ¶
func Decompress[T any](a [][]T) (r []T)
func DecompressBy ¶
func Diff ¶
func Diff[T comparable](a []T, b ...[]T) (r []T)
Diff return elements which in a and not in b,...
func DiffNewByFn ¶
func FilterAndMap ¶
func FilterAndToMap ¶
func FilterAndToMap[K comparable, V, T any](arr []T, fn func(T, int) (K, V, bool)) map[K]V
func GroupBy ¶
func GroupBy[K comparable, T, V any](a []T, fn func(T) (K, V)) map[K][]V
func IndexOf ¶
func IndexOf[T comparable](a []T, v T) int
func Intersect ¶
func Intersect[T comparable](a []T, b ...[]T) (r []T)
func IntersectByFn ¶
func IntersectNewByFn ¶
func IsContained ¶
func IsContained[T comparable](arr []T, a T) bool
func IsContainedByFn ¶
func Pad ¶
Pad 以指定长度将一个值填充进切片 returns a copy of the array padded to size specified by length with value. If length is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of length is less than or equal to the length of the array then no padding takes place.
func Pagination ¶
func ReversePagination ¶
func ReverseReduce ¶
func ReverseReduce[R, T any](a []T, fn func(T, R) R, r R) R
func ReverseSelf ¶
func ReverseSelf[T any](arr []T) []T
func SearchFirst ¶
func SearchLast ¶
func SimpleSort ¶
func SimpleSort[T any, O constraints.Ordered](a []T, order string, fn func(t T) O)
func SimpleSorts ¶
func SimpleSorts[T constraints.Ordered](a []T, order string)
func SimpleToMap ¶
func SimpleToMap[K comparable, V any](arr []V, fn func(V) K) map[K]V
func Sorts ¶
func Sorts[T constraints.Ordered](a []T, order string)
func SortsNew ¶
func SortsNew[T constraints.Ordered](a []T, order string) []T
func StableSort ¶
func ToAnySlice ¶
func ToMap ¶
func ToMap[K comparable, V, T any](arr []V, fn func(V) (K, T), isCoverPrev bool) map[K]T
func Unique ¶
func Unique[T comparable](a ...[]T) (r []T)
func UniqueByFn ¶
func UniqueNewByFn ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.