Documentation ¶
Index ¶
- Variables
- func BuildMap[S ~[]T, T any, M comparable](s S, fn func(T) M) map[M]T
- func Contains[E comparable](haystack []E, needle E) (bool, error)
- func ContainsAll[E comparable](haystack []E, needle []E) bool
- func ContainsAny[E comparable](haystack, needle []E) bool
- func ContainsAnyByte(haystack []byte, needle []byte) bool
- func ContainsAnyUint8(haystack []uint8, needle []uint8) bool
- func ContainsByte(haystack []byte, needle byte) bool
- func ContainsIP(haystack []net.IP, needle net.IP) bool
- func ContainsUint8(haystack []uint8, needle uint8) bool
- func Dedup[E constraints.Ordered](s []E) []E
- func DedupBools(a []bool) []bool
- func EqualUnordered[E comparable](a []E, b []E) bool
- func Filter[S ~[]T, T any](s S, fn func(T) bool) S
- func Intersection[E comparable](a, b []E) []E
- func Join(s interface{}, glue string) string
- func Map[S ~[]T, T, M any](s S, fn func(T) M) []M
- func Merge[T any](slices ...[]T) []T
- func Mutate[S ~[]T, T any](s S, fn func(T) T) S
- func Reduce[S ~[]T, T any](s S, fn func(T) bool) S
- func Reverse[E any](s []E) []E
- func Shuffle[E any](a []E, src rand.Source) []E
- func UniqArray[T comparable](arr []T) []T
Constants ¶
This section is empty.
Variables ¶
var ContainsAllBools = ContainsAll[bool]
ContainsAllBools checks if bool slice contains all elements of given slice Deprecated: use ContainsAll instead
var ContainsAllStrings = ContainsAll[string]
ContainsAllStrings checks if string slice contains all elements of given slice Deprecated: use ContainsAll instead
var ContainsAnyBool = ContainsAny[bool]
ContainsAnyBool checks if bool slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyFloat32 = ContainsAny[float32]
ContainsAnyFloat32 checks if float32 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyFloat64 = ContainsAny[float64]
ContainsAnyFloat64 checks if float64 slice any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyInt = ContainsAny[int]
ContainsAnyInt checks if int slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyInt16 = ContainsAny[int16]
ContainsAnyInt16 checks if int16 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyInt32 = ContainsAny[int32]
ContainsAnyInt32 checks if int32 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyInt64 = ContainsAny[int64]
ContainsAnyInt64 checks if int64 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyInt8 = ContainsAny[int8]
ContainsAnyInt8 checks if int8 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyString = ContainsAny[string]
ContainsAnyString checks if string slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyUint = ContainsAny[uint]
ContainsAnyUint checks if uint slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyUint16 = ContainsAny[uint16]
ContainsAnyUint16 checks if uint16 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyUint32 = ContainsAny[uint32]
ContainsAnyUint32 checks if uint32 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsAnyUint64 = ContainsAny[uint64]
ContainsAnyUint64 checks if uint64 slice contains any element from given slice Deprecated: use ContainsAny instead.
var ContainsBool = slices.Contains[[]bool, bool]
ContainsBool checks if bool slice contains given bool. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsFloat32 = slices.Contains[[]float32, float32]
ContainsFloat32 checks if float32 slice contains given float32. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsFloat64 = slices.Contains[[]float64, float64]
ContainsFloat64 checks if float64 slice contains given float64. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsInt = slices.Contains[[]int, int]
ContainsInt checks if int slice contains given int
var ContainsInt16 = slices.Contains[[]int16, int16]
ContainsInt16 checks if int16 slice contains given int16. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsInt32 = slices.Contains[[]int32, int32]
ContainsInt32 checks if int32 slice contains given int32. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsInt64 = slices.Contains[[]int64, int64]
ContainsInt64 checks if int64 slice contains given int64. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsInt8 = slices.Contains[[]int8, int8]
ContainsInt8 checks if int8 slice contains given int8. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsString = slices.Contains[[]string, string]
ContainsString checks if string slice contains given string. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsUUID = slices.Contains[[]uuid.UUID, uuid.UUID]
ContainsUUID checks if UUID slice contains given UUID. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsUint = slices.Contains[[]uint, uint]
ContainsUint checks if uint slice contains given uint. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsUint16 = slices.Contains[[]uint16, uint16]
ContainsUint16 checks if uint16 slice contains given uint16. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsUint32 = slices.Contains[[]uint32, uint32]
ContainsUint32 checks if uint32 slice contains given uint32. Deprecated: use golang.org/x/exp/slices.Contains instead
var ContainsUint64 = slices.Contains[[]uint64, uint64]
ContainsUint64 checks if uint64 slice contains given uint64. Deprecated: use golang.org/x/exp/slices.Contains instead
var DedupFloat32s = Dedup[float32]
DedupFloat32s removes duplicate values from float32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupFloat64s = Dedup[float64]
DedupFloat64s removes duplicate values from float64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupInt16s = Dedup[int16]
DedupInt16s removes duplicate values from int16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupInt32s = Dedup[int32]
DedupInt32s removes duplicate values from int32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupInt64s = Dedup[int64]
DedupInt64s removes duplicate values from int64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupInt8s = Dedup[int8]
DedupInt8s removes duplicate values from int8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupInts = Dedup[int]
DedupInts removes duplicate values from ints slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupStrings = Dedup[string]
DedupStrings removes duplicate values from string slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupUint16s = Dedup[uint16]
DedupUint16s removes duplicate values from uint16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupUint32s = Dedup[uint32]
DedupUint32s removes duplicate values from uint32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupUint64s = Dedup[uint64]
DedupUint64s removes duplicate values from uint64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupUint8s = Dedup[uint8]
DedupUint8s removes duplicate values from uint8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var DedupUints = Dedup[uint]
DedupUints removes duplicate values from uint slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.
var EqualAnyOrderStrings = EqualUnordered[string]
EqualAnyOrderStrings checks if string slices are equal, order independent. Deprecated: use EqualUnordered instead.
var IntersectBools = Intersection[bool]
IntersectBools returns intersection of two bool slices Deprecated: use Intersection instead.
var IntersectFloat32s = Intersection[float32]
IntersectFloat32s returns intersection of two float32 slices Deprecated: use Intersection instead.
var IntersectFloat64s = Intersection[float64]
IntersectFloat64s returns intersection of two float64 slices Deprecated: use Intersection instead.
var IntersectInt16s = Intersection[int16]
IntersectInt16s returns intersection of two int16 slices Deprecated: use Intersection instead.
var IntersectInt32s = Intersection[int32]
IntersectInt32s returns intersection of two int32 slices Deprecated: use Intersection instead.
var IntersectInt64s = Intersection[int64]
IntersectInt64s returns intersection of two int64 slices Deprecated: use Intersection instead.
var IntersectInt8s = Intersection[int8]
IntersectInt8s returns intersection of two int8 slices Deprecated: use Intersection instead.
var IntersectInts = Intersection[int]
IntersectInts returns intersection of two int slices Deprecated: use Intersection instead.
var IntersectStrings = Intersection[string]
IntersectStrings returns intersection of two string slices Deprecated: use Intersection instead.
var IntersectUint16s = Intersection[uint16]
IntersectUint16s returns intersection of two uint16 slices Deprecated: use Intersection instead.
var IntersectUint32s = Intersection[uint32]
IntersectUint32s returns intersection of two uint32 slices Deprecated: use Intersection instead.
var IntersectUint64s = Intersection[uint64]
IntersectUint64s returns intersection of two uint64 slices Deprecated: use Intersection instead.
var IntersectUint8s = Intersection[uint8]
IntersectUint8s returns intersection of two uint8 slices Deprecated: use Intersection instead.
var IntersectUints = Intersection[uint]
IntersectUints returns intersection of two uint slices Deprecated: use Intersection instead.
var ReverseBools = Reverse[bool]
ReverseBools reverses given bool slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseFloat32s = Reverse[float32]
ReverseFloat32s reverses given float32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseFloat64s = Reverse[float64]
ReverseFloat64s reverses given float64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseInt16s = Reverse[int16]
ReverseInt16s reverses given int16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseInt32s = Reverse[int32]
ReverseInt32s reverses given int32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseInt64s = Reverse[int64]
ReverseInt64s reverses given int64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseInt8s = Reverse[int8]
ReverseInt8s reverses given int8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseInts = Reverse[int]
ReverseInts reverses given int slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseStrings = Reverse[string]
ReverseStrings reverses given string slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseUint16s = Reverse[uint16]
ReverseUint16s reverses given uint16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseUint32s = Reverse[uint32]
ReverseUint32s reverses given uint32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseUint64s = Reverse[uint64]
ReverseUint64s reverses given uint64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseUint8s = Reverse[uint8]
ReverseUint8s reverses given uint8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ReverseUints = Reverse[uint]
ReverseUints reverses given uint slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.
var ShuffleBools = Shuffle[bool]
ShuffleBools shuffles values in bool slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleFloat32s = Shuffle[float32]
ShuffleFloat32s shuffles values in float32 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleFloat64s = Shuffle[float64]
ShuffleFloat64s shuffles values in float64 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleInt16s = Shuffle[int16]
ShuffleInt16s shuffles values in int16 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleInt32s = Shuffle[int32]
ShuffleInt32s shuffles values in int32 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleInt64s = Shuffle[int64]
ShuffleInt64s shuffles values in int64 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleInt8s = Shuffle[int8]
ShuffleInt8s shuffles values in int8 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleInts = Shuffle[int]
ShuffleInts shuffles values in int slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleStrings = Shuffle[string]
ShuffleStrings shuffles values in string slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleUint16s = Shuffle[uint16]
ShuffleUint16s shuffles values in uint16 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleUint32s = Shuffle[uint32]
ShuffleUint32s shuffles values in uint32 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleUint64s = Shuffle[uint64]
ShuffleUint64s shuffles values in uint64 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleUint8s = Shuffle[uint8]
ShuffleUint8s shuffles values in uint8 slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
var ShuffleUints = Shuffle[uint]
ShuffleUints shuffles values in uint slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Shuffle instead.
Functions ¶
func BuildMap ¶ added in v1.0.7
func BuildMap[S ~[]T, T any, M comparable](s S, fn func(T) M) map[M]T
BuildMap builds map from slice
func Contains ¶ added in v1.0.4
func Contains[E comparable](haystack []E, needle E) (bool, error)
Contains checks if slice of T contains given T Deprecated: use golang.org/x/exp/slices.Contains instead.
func ContainsAll ¶ added in v1.0.4
func ContainsAll[E comparable](haystack []E, needle []E) bool
ContainsAll checks if slice of type E contains all elements of given slice, order independent
func ContainsAny ¶ added in v1.0.4
func ContainsAny[E comparable](haystack, needle []E) bool
ContainsAny checks if slice of type E contains any element from given slice
func ContainsAnyByte ¶ added in v1.0.4
ContainsAnyByte checks if byte slice contains any element from given slice
func ContainsAnyUint8 ¶ added in v1.0.4
ContainsAnyUint8 checks if uint8 slice contains any element from given slice
func ContainsByte ¶ added in v1.0.4
ContainsByte checks if byte slice contains given byte
func ContainsIP ¶ added in v1.0.4
ContainsIP checks if net.IP slice contains given net.IP
func ContainsUint8 ¶ added in v1.0.4
ContainsUint8 checks if uint8 slice contains given uint8.
func Dedup ¶ added in v1.0.4
func Dedup[E constraints.Ordered](s []E) []E
Dedup removes duplicate values from slice. It will alter original non-empty slice, consider copy it beforehand.
func DedupBools ¶ added in v1.0.4
DedupBools removes duplicate values from bool slice. It will alter original non-empty slice, consider copy it beforehand.
func EqualUnordered ¶ added in v1.0.4
func EqualUnordered[E comparable](a []E, b []E) bool
EqualUnordered checks if slices of type E are equal, order independent.
func Filter ¶ added in v1.0.4
Filter reduces slice values using given function. It operates with a copy of given slice
func Intersection ¶ added in v1.0.4
func Intersection[E comparable](a, b []E) []E
Intersection returns intersection for slices of various built-in types
func Map ¶ added in v1.0.4
func Map[S ~[]T, T, M any](s S, fn func(T) M) []M
Map applies given function to every value of slice
func Mutate ¶ added in v1.0.4
func Mutate[S ~[]T, T any](s S, fn func(T) T) S
Mutate is like Map, but it prohibits type changes and modifies original slice.
func Reverse ¶ added in v1.0.4
func Reverse[E any](s []E) []E
Reverse reverses given slice. It will alter original non-empty slice, consider copy it beforehand.
func Shuffle ¶ added in v1.0.4
Shuffle shuffles values in slice using given or pseudo-random source. It will alter original non-empty slice, consider copy it beforehand.
func UniqArray ¶
func UniqArray[T comparable](arr []T) []T
Types ¶
This section is empty.