Documentation
¶
Index ¶
- func All[T any](s []T, f func(x T) bool) bool
- func Any[T comparable](s []T, f func(T) bool) bool
- func Average[T Number](s []T) float64
- func Contains[T comparable](term T, s []T) bool
- func Distinct[T comparable](s []T) []T
- func Except[T comparable](s []T, s1 []T) []T
- func Exists[T comparable](s []T, item T) bool
- func First[T any](s []T) (T, error)
- func FirstWhere[T any](s []T, f func(x T) bool) (T, error)
- func Flatten[T any](s [][]T) []T
- func Index[T comparable](term T, s []T) int
- func Intersct[T comparable](s []T, s1 []T) []T
- func Join[T any](s ...[]T) []T
- func JoinWhere[T any](f func(x T) bool, s ...[]T) []T
- func Last[T any](s []T) (T, error)
- func LastWhere[T any](s []T, f func(x T) bool) (T, error)
- func Max[T Number](s []T) T
- func Min[T Number](s []T) T
- func OrderBy[T any, T2 constraints.Ordered](s []T, f func(x T) T2) []T
- func OrderByDescending[T any, T1 constraints.Ordered](s []T, f func(x T) T1) []T
- func Range[T any](s []T, start int, end int) []T
- func Reduce[T any](s []T, f func(x T, y T) T, initial T) T
- func Reverse[T any](s []T) []T
- func Select[T any, T2 any](s []T, f func(T) T2) []T2
- func Skip[T any](s []T, n int) ([]T, error)
- func Sum[T Number](s []T) T
- func Take[T any](s []T, n int) ([]T, error)
- func Where[T comparable](s []T, f func(T) bool) []T
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶
func Any[T comparable](s []T, f func(T) bool) bool
Any return true if item in slice satisfies func
func Contains ¶
func Contains[T comparable](term T, s []T) bool
Contains returns true if term is contained in slice, else false
func Distinct ¶ added in v1.0.4
func Distinct[T comparable](s []T) []T
Distinct returns slice of distinct values
func Except ¶ added in v1.0.9
func Except[T comparable](s []T, s1 []T) []T
Except retusn slice of items in first slice but not in second
func Exists ¶ added in v1.0.4
func Exists[T comparable](s []T, item T) bool
Exists return true if item exists in slice
func FirstWhere ¶ added in v1.0.7
FirstWhere returns first item in slice in slice that satisfies func or error if slice contains no items
func Flatten ¶ added in v1.0.8
func Flatten[T any](s [][]T) []T
Flatten returns slice from slice of slice
func Index ¶
func Index[T comparable](term T, s []T) int
Index returns index of item if found in slice else returns -1
func Intersct ¶ added in v1.0.9
func Intersct[T comparable](s []T, s1 []T) []T
Intersect returns slice of items that are in both slices
func JoinWhere ¶ added in v1.0.4
JoinWhere merges items in provided slices where item satisfies func
func LastWhere ¶ added in v1.0.7
LastWhere returns last item in slice in slice that satisfies func or error if slice contains no items
func OrderBy ¶ added in v0.1.7
func OrderBy[T any, T2 constraints.Ordered](s []T, f func(x T) T2) []T
OrderBy returns slice with items ordered by returned item in func in ascending order
func OrderByDescending ¶ added in v0.1.7
func OrderByDescending[T any, T1 constraints.Ordered](s []T, f func(x T) T1) []T
OrderByDescending returns slice with items ordered by returned item in func in descending order
func Reduce ¶ added in v1.0.6
func Reduce[T any](s []T, f func(x T, y T) T, initial T) T
Reduce executes a user-supplied "reducer" function on each element of the slice
func Where ¶
func Where[T comparable](s []T, f func(T) bool) []T
Where return slice of items where item in slice satisfies func