Documentation
¶
Overview ¶
Package gslice Author: hyphen Copyright 2023 hyphen. All rights reserved. Create-time: 2023/12/4
Index ¶
- func All[T any](s []T, fc func(T) bool) bool
- func Any[T any](s []T, fc func(T) bool) bool
- func Contains[T comparable](s []T, v T) bool
- func ContainsAll[T comparable](s []T, vs ...T) bool
- func ContainsAny[T comparable](s []T, vs ...T) bool
- func DeepCopy[T any, S ~[]T](s S) S
- func Distinct[T comparable](s []T) []T
- func DistinctBy[K comparable, V any](s []V, fc func(V) K) []V
- func Equal[T comparable](s1, s2 []T) bool
- func EqualBy[T any](s1, s2 []T, eq func(T, T) bool) bool
- func EqualStrict[T comparable](s1, s2 []T) bool
- func Filter[F any](s []F, fc func(F) bool) []F
- func FilterMap[F, T any](s []F, fc func(F) (T, bool)) []T
- func Find[T any](s []T, f func(T) bool) (T, bool)
- func FindRev[T any](s []T, f func(T) bool) (T, bool)
- func First[T any, S ~[]T](s S, fc func(T) bool) (T, bool)
- func Fold[T1, T2 any](s []T1, fc func(T2, T1) T2, init T2) T2
- func ForEach[T any](s []T, fc func(T))
- func ForEachIdx[T any](s []T, fc func(int, T))
- func GroupBy[K comparable, T any, S ~[]T](s S, f func(T) K) map[K]S
- func Last[T any, S ~[]T](s S, fc func(T) bool) (T, bool)
- func LastE[T any](s []T) T
- func Map[F, T any](s []F, fc func(F) T) []T
- func MinMaxBy[T any](s []T, less func(T, T) bool) (T, T)
- func Reduce[T any](s []T, fc func(T, T) T) T
- func Reject[T any](s []T, fc func(T) bool) []T
- func Remove[T comparable](s []T, v T) []T
- func RemoveN[T comparable](s []T, v T, n int) []T
- func SafeAsserts[To, From any](s []From) []To
- func ToMap[F, V any, K comparable](s []F, fc func(F) (K, V)) map[K]V
- func TryMap[F, T any](s []F, fc func(F) (T, error)) ([]T, error)
- func Union[K comparable](ss ...[]K) []K
- func UnsafeAsserts[To, From any](s []From) []To
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶ added in v0.3.0
func Contains[T comparable](s []T, v T) bool
func ContainsAll ¶ added in v0.3.0
func ContainsAll[T comparable](s []T, vs ...T) bool
func ContainsAny ¶ added in v0.3.0
func ContainsAny[T comparable](s []T, vs ...T) bool
func Distinct ¶ added in v0.3.0
func Distinct[T comparable](s []T) []T
func DistinctBy ¶ added in v0.3.0
func DistinctBy[K comparable, V any](s []V, fc func(V) K) []V
func Equal ¶ added in v0.4.0
func Equal[T comparable](s1, s2 []T) bool
func EqualStrict ¶ added in v0.4.0
func EqualStrict[T comparable](s1, s2 []T) bool
func ForEachIdx ¶
func GroupBy ¶ added in v0.3.0
func GroupBy[K comparable, T any, S ~[]T](s S, f func(T) K) map[K]S
func Remove ¶ added in v0.3.0
func Remove[T comparable](s []T, v T) []T
func RemoveN ¶ added in v0.3.0
func RemoveN[T comparable](s []T, v T, n int) []T
func SafeAsserts ¶ added in v0.4.0
func SafeAsserts[To, From any](s []From) []To
func ToMap ¶
func ToMap[F, V any, K comparable](s []F, fc func(F) (K, V)) map[K]V
func Union ¶ added in v0.4.0
func Union[K comparable](ss ...[]K) []K
func UnsafeAsserts ¶ added in v0.4.0
func UnsafeAsserts[To, From any](s []From) []To
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.