arrayx

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

arrayx

import "github.com/ccheers/xpkg/generic/arrayx"

Index

Variables

ContainsAllBools checks if bool slice contains all elements of given slice Deprecated: use ContainsAll instead

var ContainsAllBools = ContainsAll[bool]

ContainsAllStrings checks if string slice contains all elements of given slice Deprecated: use ContainsAll instead

var ContainsAllStrings = ContainsAll[string]

ContainsAnyBool checks if bool slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyBool = ContainsAny[bool]

ContainsAnyFloat32 checks if float32 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyFloat32 = ContainsAny[float32]

ContainsAnyFloat64 checks if float64 slice any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyFloat64 = ContainsAny[float64]

ContainsAnyInt checks if int slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyInt = ContainsAny[int]

ContainsAnyInt16 checks if int16 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyInt16 = ContainsAny[int16]

ContainsAnyInt32 checks if int32 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyInt32 = ContainsAny[int32]

ContainsAnyInt64 checks if int64 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyInt64 = ContainsAny[int64]

ContainsAnyInt8 checks if int8 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyInt8 = ContainsAny[int8]

ContainsAnyString checks if string slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyString = ContainsAny[string]

ContainsAnyUint checks if uint slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyUint = ContainsAny[uint]

ContainsAnyUint16 checks if uint16 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyUint16 = ContainsAny[uint16]

ContainsAnyUint32 checks if uint32 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyUint32 = ContainsAny[uint32]

ContainsAnyUint64 checks if uint64 slice contains any element from given slice Deprecated: use ContainsAny instead.

var ContainsAnyUint64 = ContainsAny[uint64]

ContainsBool checks if bool slice contains given bool. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsBool = slices.Contains[bool]

ContainsFloat32 checks if float32 slice contains given float32. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsFloat32 = slices.Contains[float32]

ContainsFloat64 checks if float64 slice contains given float64. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsFloat64 = slices.Contains[float64]

ContainsInt checks if int slice contains given int

var ContainsInt = slices.Contains[int]

ContainsInt16 checks if int16 slice contains given int16. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsInt16 = slices.Contains[int16]

ContainsInt32 checks if int32 slice contains given int32. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsInt32 = slices.Contains[int32]

ContainsInt64 checks if int64 slice contains given int64. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsInt64 = slices.Contains[int64]

ContainsInt8 checks if int8 slice contains given int8. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsInt8 = slices.Contains[int8]

ContainsString checks if string slice contains given string. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsString = slices.Contains[string]

ContainsUUID checks if UUID slice contains given UUID. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsUUID = slices.Contains[uuid.UUID]

ContainsUint checks if uint slice contains given uint. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsUint = slices.Contains[uint]

ContainsUint16 checks if uint16 slice contains given uint16. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsUint16 = slices.Contains[uint16]

ContainsUint32 checks if uint32 slice contains given uint32. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsUint32 = slices.Contains[uint32]

ContainsUint64 checks if uint64 slice contains given uint64. Deprecated: use golang.org/x/exp/slices.Contains instead

var ContainsUint64 = slices.Contains[uint64]

DedupFloat32s removes duplicate values from float32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupFloat32s = Dedup[float32]

DedupFloat64s removes duplicate values from float64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupFloat64s = Dedup[float64]

DedupInt16s removes duplicate values from int16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupInt16s = Dedup[int16]

DedupInt32s removes duplicate values from int32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupInt32s = Dedup[int32]

DedupInt64s removes duplicate values from int64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupInt64s = Dedup[int64]

DedupInt8s removes duplicate values from int8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupInt8s = Dedup[int8]

DedupInts removes duplicate values from ints slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupInts = Dedup[int]

DedupStrings removes duplicate values from string slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupStrings = Dedup[string]

DedupUint16s removes duplicate values from uint16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupUint16s = Dedup[uint16]

DedupUint32s removes duplicate values from uint32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupUint32s = Dedup[uint32]

DedupUint64s removes duplicate values from uint64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupUint64s = Dedup[uint64]

DedupUint8s removes duplicate values from uint8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupUint8s = Dedup[uint8]

DedupUints removes duplicate values from uint slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Dedup instead.

var DedupUints = Dedup[uint]

EqualAnyOrderStrings checks if string slices are equal, order independent. Deprecated: use EqualUnordered instead.

var EqualAnyOrderStrings = EqualUnordered[string]

IntersectBools returns intersection of two bool slices Deprecated: use Intersection instead.

var IntersectBools = Intersection[bool]

IntersectFloat32s returns intersection of two float32 slices Deprecated: use Intersection instead.

var IntersectFloat32s = Intersection[float32]

IntersectFloat64s returns intersection of two float64 slices Deprecated: use Intersection instead.

var IntersectFloat64s = Intersection[float64]

IntersectInt16s returns intersection of two int16 slices Deprecated: use Intersection instead.

var IntersectInt16s = Intersection[int16]

IntersectInt32s returns intersection of two int32 slices Deprecated: use Intersection instead.

var IntersectInt32s = Intersection[int32]

IntersectInt64s returns intersection of two int64 slices Deprecated: use Intersection instead.

var IntersectInt64s = Intersection[int64]

IntersectInt8s returns intersection of two int8 slices Deprecated: use Intersection instead.

var IntersectInt8s = Intersection[int8]

IntersectInts returns intersection of two int slices Deprecated: use Intersection instead.

var IntersectInts = Intersection[int]

IntersectStrings returns intersection of two string slices Deprecated: use Intersection instead.

var IntersectStrings = Intersection[string]

IntersectUint16s returns intersection of two uint16 slices Deprecated: use Intersection instead.

var IntersectUint16s = Intersection[uint16]

IntersectUint32s returns intersection of two uint32 slices Deprecated: use Intersection instead.

var IntersectUint32s = Intersection[uint32]

IntersectUint64s returns intersection of two uint64 slices Deprecated: use Intersection instead.

var IntersectUint64s = Intersection[uint64]

IntersectUint8s returns intersection of two uint8 slices Deprecated: use Intersection instead.

var IntersectUint8s = Intersection[uint8]

IntersectUints returns intersection of two uint slices Deprecated: use Intersection instead.

var IntersectUints = Intersection[uint]

ReverseBools reverses given bool slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseBools = Reverse[bool]

ReverseFloat32s reverses given float32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseFloat32s = Reverse[float32]

ReverseFloat64s reverses given float64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseFloat64s = Reverse[float64]

ReverseInt16s reverses given int16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseInt16s = Reverse[int16]

ReverseInt32s reverses given int32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseInt32s = Reverse[int32]

ReverseInt64s reverses given int64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseInt64s = Reverse[int64]

ReverseInt8s reverses given int8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseInt8s = Reverse[int8]

ReverseInts reverses given int slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseInts = Reverse[int]

ReverseStrings reverses given string slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseStrings = Reverse[string]

ReverseUint16s reverses given uint16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseUint16s = Reverse[uint16]

ReverseUint32s reverses given uint32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseUint32s = Reverse[uint32]

ReverseUint64s reverses given uint64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseUint64s = Reverse[uint64]

ReverseUint8s reverses given uint8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseUint8s = Reverse[uint8]

ReverseUints reverses given uint slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

var ReverseUints = Reverse[uint]

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 ShuffleBools = Shuffle[bool]

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 ShuffleFloat32s = Shuffle[float32]

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 ShuffleFloat64s = Shuffle[float64]

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 ShuffleInt16s = Shuffle[int16]

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 ShuffleInt32s = Shuffle[int32]

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 ShuffleInt64s = Shuffle[int64]

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 ShuffleInt8s = Shuffle[int8]

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 ShuffleInts = Shuffle[int]

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 ShuffleStrings = Shuffle[string]

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 ShuffleUint16s = Shuffle[uint16]

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 ShuffleUint32s = Shuffle[uint32]

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 ShuffleUint64s = Shuffle[uint64]

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 ShuffleUint8s = Shuffle[uint8]

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.

var ShuffleUints = Shuffle[uint]

func Contains

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

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

func ContainsAny[E comparable](haystack, needle []E) bool

ContainsAny checks if slice of type E contains any element from given slice

func ContainsAnyByte

func ContainsAnyByte(haystack []byte, needle []byte) bool

ContainsAnyByte checks if byte slice contains any element from given slice

func ContainsAnyUint8

func ContainsAnyUint8(haystack []uint8, needle []uint8) bool

ContainsAnyUint8 checks if uint8 slice contains any element from given slice

func ContainsByte

func ContainsByte(haystack []byte, needle byte) bool

ContainsByte checks if byte slice contains given byte

func ContainsIP

func ContainsIP(haystack []net.IP, needle net.IP) bool

ContainsIP checks if net.IP slice contains given net.IP

func ContainsUint8

func ContainsUint8(haystack []uint8, needle uint8) bool

ContainsUint8 checks if uint8 slice contains given uint8.

func Dedup

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

func DedupBools(a []bool) []bool

DedupBools removes duplicate values from bool slice. It will alter original non-empty slice, consider copy it beforehand.

func EqualUnordered

func EqualUnordered[E comparable](a []E, b []E) bool

EqualUnordered checks if slices of type E are equal, order independent.

func Filter

func Filter[S ~[]T, T any](s S, fn func(T) bool) S

Filter reduces slice values using given function. It operates with a copy of given slice

func Intersection

func Intersection[E comparable](a, b []E) []E

Intersection returns intersection for slices of various built-in types

func Join

func Join(s interface{}, glue string) string

Join joins slice of any types

func Map

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

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 Reduce

func Reduce[S ~[]T, T any](s S, fn func(T) bool) S

Reduce is like Filter, but modifies original slice.

func Reverse

func Reverse[E any](s []E) []E

Reverse reverses given slice. It will alter original non-empty slice, consider copy it beforehand.

func Shuffle

func Shuffle[E any](a []E, src rand.Source) []E

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

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContainsAllBools = ContainsAll[bool]

ContainsAllBools checks if bool slice contains all elements of given slice Deprecated: use ContainsAll instead

View Source
var ContainsAllStrings = ContainsAll[string]

ContainsAllStrings checks if string slice contains all elements of given slice Deprecated: use ContainsAll instead

View Source
var ContainsAnyBool = ContainsAny[bool]

ContainsAnyBool checks if bool slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyFloat32 = ContainsAny[float32]

ContainsAnyFloat32 checks if float32 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyFloat64 = ContainsAny[float64]

ContainsAnyFloat64 checks if float64 slice any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyInt = ContainsAny[int]

ContainsAnyInt checks if int slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyInt16 = ContainsAny[int16]

ContainsAnyInt16 checks if int16 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyInt32 = ContainsAny[int32]

ContainsAnyInt32 checks if int32 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyInt64 = ContainsAny[int64]

ContainsAnyInt64 checks if int64 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyInt8 = ContainsAny[int8]

ContainsAnyInt8 checks if int8 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyString = ContainsAny[string]

ContainsAnyString checks if string slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyUint = ContainsAny[uint]

ContainsAnyUint checks if uint slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyUint16 = ContainsAny[uint16]

ContainsAnyUint16 checks if uint16 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyUint32 = ContainsAny[uint32]

ContainsAnyUint32 checks if uint32 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsAnyUint64 = ContainsAny[uint64]

ContainsAnyUint64 checks if uint64 slice contains any element from given slice Deprecated: use ContainsAny instead.

View Source
var ContainsBool = slices.Contains[bool]

ContainsBool checks if bool slice contains given bool. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsFloat32 = slices.Contains[float32]

ContainsFloat32 checks if float32 slice contains given float32. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsFloat64 = slices.Contains[float64]

ContainsFloat64 checks if float64 slice contains given float64. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsInt = slices.Contains[int]

ContainsInt checks if int slice contains given int

View Source
var ContainsInt16 = slices.Contains[int16]

ContainsInt16 checks if int16 slice contains given int16. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsInt32 = slices.Contains[int32]

ContainsInt32 checks if int32 slice contains given int32. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsInt64 = slices.Contains[int64]

ContainsInt64 checks if int64 slice contains given int64. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsInt8 = slices.Contains[int8]

ContainsInt8 checks if int8 slice contains given int8. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsString = slices.Contains[string]

ContainsString checks if string slice contains given string. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsUUID = slices.Contains[uuid.UUID]

ContainsUUID checks if UUID slice contains given UUID. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsUint = slices.Contains[uint]

ContainsUint checks if uint slice contains given uint. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsUint16 = slices.Contains[uint16]

ContainsUint16 checks if uint16 slice contains given uint16. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsUint32 = slices.Contains[uint32]

ContainsUint32 checks if uint32 slice contains given uint32. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
var ContainsUint64 = slices.Contains[uint64]

ContainsUint64 checks if uint64 slice contains given uint64. Deprecated: use golang.org/x/exp/slices.Contains instead

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
var EqualAnyOrderStrings = EqualUnordered[string]

EqualAnyOrderStrings checks if string slices are equal, order independent. Deprecated: use EqualUnordered instead.

View Source
var IntersectBools = Intersection[bool]

IntersectBools returns intersection of two bool slices Deprecated: use Intersection instead.

View Source
var IntersectFloat32s = Intersection[float32]

IntersectFloat32s returns intersection of two float32 slices Deprecated: use Intersection instead.

View Source
var IntersectFloat64s = Intersection[float64]

IntersectFloat64s returns intersection of two float64 slices Deprecated: use Intersection instead.

View Source
var IntersectInt16s = Intersection[int16]

IntersectInt16s returns intersection of two int16 slices Deprecated: use Intersection instead.

View Source
var IntersectInt32s = Intersection[int32]

IntersectInt32s returns intersection of two int32 slices Deprecated: use Intersection instead.

View Source
var IntersectInt64s = Intersection[int64]

IntersectInt64s returns intersection of two int64 slices Deprecated: use Intersection instead.

View Source
var IntersectInt8s = Intersection[int8]

IntersectInt8s returns intersection of two int8 slices Deprecated: use Intersection instead.

View Source
var IntersectInts = Intersection[int]

IntersectInts returns intersection of two int slices Deprecated: use Intersection instead.

View Source
var IntersectStrings = Intersection[string]

IntersectStrings returns intersection of two string slices Deprecated: use Intersection instead.

View Source
var IntersectUint16s = Intersection[uint16]

IntersectUint16s returns intersection of two uint16 slices Deprecated: use Intersection instead.

View Source
var IntersectUint32s = Intersection[uint32]

IntersectUint32s returns intersection of two uint32 slices Deprecated: use Intersection instead.

View Source
var IntersectUint64s = Intersection[uint64]

IntersectUint64s returns intersection of two uint64 slices Deprecated: use Intersection instead.

View Source
var IntersectUint8s = Intersection[uint8]

IntersectUint8s returns intersection of two uint8 slices Deprecated: use Intersection instead.

View Source
var IntersectUints = Intersection[uint]

IntersectUints returns intersection of two uint slices Deprecated: use Intersection instead.

View Source
var ReverseBools = Reverse[bool]

ReverseBools reverses given bool slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseFloat32s = Reverse[float32]

ReverseFloat32s reverses given float32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseFloat64s = Reverse[float64]

ReverseFloat64s reverses given float64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseInt16s = Reverse[int16]

ReverseInt16s reverses given int16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseInt32s = Reverse[int32]

ReverseInt32s reverses given int32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseInt64s = Reverse[int64]

ReverseInt64s reverses given int64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseInt8s = Reverse[int8]

ReverseInt8s reverses given int8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseInts = Reverse[int]

ReverseInts reverses given int slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseStrings = Reverse[string]

ReverseStrings reverses given string slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseUint16s = Reverse[uint16]

ReverseUint16s reverses given uint16 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseUint32s = Reverse[uint32]

ReverseUint32s reverses given uint32 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseUint64s = Reverse[uint64]

ReverseUint64s reverses given uint64 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseUint8s = Reverse[uint8]

ReverseUint8s reverses given uint8 slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
var ReverseUints = Reverse[uint]

ReverseUints reverses given uint slice. It will alter original non-empty slice, consider copy it beforehand. Deprecated: use Reverse instead.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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

func ContainsAnyByte(haystack []byte, needle []byte) bool

ContainsAnyByte checks if byte slice contains any element from given slice

func ContainsAnyUint8 added in v1.0.4

func ContainsAnyUint8(haystack []uint8, needle []uint8) bool

ContainsAnyUint8 checks if uint8 slice contains any element from given slice

func ContainsByte added in v1.0.4

func ContainsByte(haystack []byte, needle byte) bool

ContainsByte checks if byte slice contains given byte

func ContainsIP added in v1.0.4

func ContainsIP(haystack []net.IP, needle net.IP) bool

ContainsIP checks if net.IP slice contains given net.IP

func ContainsUint8 added in v1.0.4

func ContainsUint8(haystack []uint8, needle uint8) bool

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

func DedupBools(a []bool) []bool

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

func Filter[S ~[]T, T any](s S, fn func(T) bool) S

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 Join added in v1.0.4

func Join(s interface{}, glue string) string

Join joins slice of any 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 Merge added in v1.1.2

func Merge[T any](slices ...[]T) []T

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 Reduce added in v1.0.4

func Reduce[S ~[]T, T any](s S, fn func(T) bool) S

Reduce is like Filter, but 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

func Shuffle[E any](a []E, src rand.Source) []E

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL