Documentation ¶
Index ¶
- Variables
- func ArrayChunk[S ~[]T, T any](s S, size int) ([]S, error)
- func ArrayCopy[S ~[]T, T any](s S) S
- func ArrayDiff[S ~[]T, T comparable](first, second S) S
- func ArrayFill[S ~[]T, T any](startIndex int, num int, value T) S
- func ArrayFilter[S ~[]T, T any](f ArrayFilterFunc[T], s S) S
- func ArrayFlip[S ~[]T, T comparable](s S) map[T]int
- func ArrayInsert[S ~[]T, T any](s *S, indx int, elems ...T)
- func ArrayIntersect[S ~[]T, T comparable](first, second S) S
- func ArrayMap[S ~[]T, T any](f ArrayMapFunc[T], s S) S
- func ArrayMax[S ~[]T, T constraints.Ordered](s S) T
- func ArrayMerge[S ~[]T, T any](arrs ...S) S
- func ArrayMin[S ~[]T, T constraints.Ordered](s S) T
- func ArrayPad[S ~[]T, T any](s S, size int, val T) S
- func ArrayPop[S ~[]T, T any](s *S) T
- func ArrayPush[S ~[]T, T any](s *S, elements ...T)
- func ArrayRand[S ~[]T, T any](elements S) S
- func ArrayReduce[S ~[]T, T any](f ArrayReduceFunc[T], s S, init T) T
- func ArrayRemove[S ~[]T, T any](s *S, indx int)
- func ArrayReverse[S ~[]T, T any](s S) S
- func ArrayShift[S ~[]T, T any](s *S) T
- func ArraySlice[S ~[]T, T any](s S, offset, length int) (S, error)
- func ArrayStructToArrayValuesByField[S ~[]T, T, M any](s S, fields []string) []M
- func ArrayStructToMapByField[S ~[]T, T any, O comparable](s S, fields []string) map[O]T
- func ArrayToMapValues[S ~[]T, T comparable](s S) map[T]struct{}
- func ArrayToMapValuesBool[S ~[]T, T comparable](s S) map[T]bool
- func ArrayUnique[S ~[]T, T comparable](s S) S
- func ArrayUnshift[S ~[]T, T any](s *S, elements ...T)
- func InArray[S ~[]T, T comparable](s S, needle T) bool
- func InMap[M ~map[K]V, K, V comparable](m M, needle V) bool
- func MapCombine[M ~map[K]V, K, V comparable](s1 []K, s2 []V) (M, error)
- func MapFlip[M ~map[K]V, R ~map[V]K, K, V comparable](m M) R
- func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
- func MapValues[M ~map[K]V, K comparable, V any](m M) []V
- func Ternary[T any](cond bool, first, second T) T
- type ArrayFilterFunc
- type ArrayMapFunc
- type ArrayReduceFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrArrayChunkSize = errors.New("size must be greater than 0")
)
View Source
var (
ErrArraySliceOffset = errors.New("offset must be less than length array")
)
View Source
var (
ErrMapCombine = errors.New("slices must has equal length")
)
Functions ¶
func ArrayChunk ¶
func ArrayDiff ¶
func ArrayDiff[S ~[]T, T comparable](first, second S) S
func ArrayFilter ¶
func ArrayFilter[S ~[]T, T any](f ArrayFilterFunc[T], s S) S
func ArrayFlip ¶
func ArrayFlip[S ~[]T, T comparable](s S) map[T]int
func ArrayInsert ¶ added in v1.0.2
func ArrayIntersect ¶
func ArrayIntersect[S ~[]T, T comparable](first, second S) S
func ArrayMap ¶
func ArrayMap[S ~[]T, T any](f ArrayMapFunc[T], s S) S
func ArrayMax ¶
func ArrayMax[S ~[]T, T constraints.Ordered](s S) T
func ArrayMerge ¶
func ArrayMerge[S ~[]T, T any](arrs ...S) S
func ArrayMin ¶
func ArrayMin[S ~[]T, T constraints.Ordered](s S) T
func ArrayReduce ¶
func ArrayReduce[S ~[]T, T any](f ArrayReduceFunc[T], s S, init T) T
func ArrayRemove ¶
func ArrayReverse ¶
func ArrayReverse[S ~[]T, T any](s S) S
func ArrayShift ¶
func ArrayShift[S ~[]T, T any](s *S) T
func ArraySlice ¶
func ArrayStructToArrayValuesByField ¶ added in v1.0.12
func ArrayStructToMapByField ¶
func ArrayStructToMapByField[S ~[]T, T any, O comparable](s S, fields []string) map[O]T
func ArrayToMapValues ¶
func ArrayToMapValues[S ~[]T, T comparable](s S) map[T]struct{}
func ArrayToMapValuesBool ¶ added in v1.0.16
func ArrayToMapValuesBool[S ~[]T, T comparable](s S) map[T]bool
func ArrayUnique ¶
func ArrayUnique[S ~[]T, T comparable](s S) S
func ArrayUnshift ¶
func ArrayUnshift[S ~[]T, T any](s *S, elements ...T)
func InArray ¶
func InArray[S ~[]T, T comparable](s S, needle T) bool
func InMap ¶
func InMap[M ~map[K]V, K, V comparable](m M, needle V) bool
func MapCombine ¶
func MapCombine[M ~map[K]V, K, V comparable](s1 []K, s2 []V) (M, error)
func MapFlip ¶
func MapFlip[M ~map[K]V, R ~map[V]K, K, V comparable](m M) R
func MapKeys ¶
func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
func MapValues ¶
func MapValues[M ~map[K]V, K comparable, V any](m M) []V
Types ¶
type ArrayFilterFunc ¶
type ArrayMapFunc ¶
type ArrayMapFunc[T any] func(elem T) T
type ArrayReduceFunc ¶
type ArrayReduceFunc[T any] func(first, second T) T
Source Files ¶
- array_chunk.go
- array_copy.go
- array_diff.go
- array_fill.go
- array_filter.go
- array_flip.go
- array_insert.go
- array_intersect.go
- array_map.go
- array_max.go
- array_merge.go
- array_min.go
- array_pad.go
- array_pop.go
- array_push.go
- array_rand.go
- array_reduce.go
- array_remove.go
- array_reverse.go
- array_shift.go
- array_slice.go
- array_struct_to_array_values_by_field.go
- array_struct_to_map.go
- array_to_map_values.go
- array_to_map_values_bool.go
- array_unique.go
- array_unshift.go
- in_array.go
- in_map.go
- map_combine.go
- map_flip.go
- map_keys.go
- map_values.go
- ternary.go
Click to show internal directories.
Click to hide internal directories.