Documentation
¶
Index ¶
- func Chunk[T comparable](items []T, size int) [][]T
- func Diff[T comparable](values ...[]T) []T
- func Filter[T comparable](values []T, f func(v T) bool) []T
- func IntSliceDiff(ss ...[]int) []int
- func IntSliceEqual(a, b []int) bool
- func IntSliceReverse(ss []int) []int
- func IntToInterface(values []int) []interface{}
- func Map[T comparable](values []T, f func(v T) T) []T
- func StringSliceDiff(ss ...[]string) []string
- func StringSliceEqual(a, b []string, caseSensitive, ignoreEmpty, trim bool) bool
- func StringSliceReverse(ss []string) []string
- func StringToInterface(values []string) []interface{}
- func ToInterface[T gox.Number | ~string](values []T) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
func Diff[T comparable](values ...[]T) []T
Diff return a slice in ss[0] and not in ss[1:]
func Filter ¶
func Filter[T comparable](values []T, f func(v T) bool) []T
Filter return matched f function condition value
Example:
Filter([]int{0, 1, 2, 3}, func(v int) bool { return v > 0 }) // Output: [1, 2, 3]
func IntSliceDiff ¶
func IntSliceReverse ¶
func IntToInterface ¶
func IntToInterface(values []int) []interface{}
IntToInterface Change int slice to interface slice
func Map ¶
func Map[T comparable](values []T, f func(v T) T) []T
Map values all value execute f function, and return a new slice
Example
Map([]string{"A", "B", "C"}, func(v string) string { return strings.ToLower(v) }) // Output: ["a", "b", "c"]
func StringSliceDiff ¶
func StringSliceEqual ¶
StringSliceEqual Check a, b is equal
func StringSliceReverse ¶
func StringToInterface ¶
func StringToInterface(values []string) []interface{}
StringToInterface Change string slice to interface slice
func ToInterface ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.