Documentation
¶
Overview ¶
Package slice wraps up some common operations regarding to golang slice with different types.
Index ¶
- func ContainsInt(x []int, y int) bool
- func ContainsInt64(x []int64, y int64) bool
- func ContainsString(x []string, y string) bool
- func ContainsUInt64(x []uint64, y uint64) bool
- func CopyInt64s(x []int64) []int64
- func CopyInts(x []int) []int
- func CopyStrings(x []string) []string
- func CopyUInt64s(x []uint64) []uint64
- func CutInt64s(x []int64, i, j int) ([]int64, error)
- func CutInts(x []int, i, j int) ([]int, error)
- func CutStrings(x []string, i, j int) ([]string, error)
- func CutUInt64s(x []uint64, i, j int) ([]uint64, error)
- func EqualsInt64s(x []int64, y []int64) bool
- func EqualsInts(x []int, y []int) bool
- func EqualsStrings(x []string, y []string) bool
- func EqualsUInt64s(x []uint64, y []uint64) bool
- func FilterInt64s(x []int64, filter func(int64) bool) []int64
- func FilterInts(x []int, filter func(int) bool) []int
- func FilterStrings(x []string, filter func(string) bool) []string
- func FilterUInt64s(x []uint64, filter func(uint64) bool) []uint64
- func IndexOfInt(x []int, y int) int
- func IndexOfInt64(x []int64, y int64) int
- func IndexOfString(x []string, y string) int
- func IndexOfUInt64(x []uint64, y uint64) int
- func InsertInt64At(x []int64, y int64, index int) ([]int64, error)
- func InsertInt64sAt(x []int64, y []int64, index int) ([]int64, error)
- func InsertIntAt(x []int, y int, index int) ([]int, error)
- func InsertIntsAt(x []int, y []int, index int) ([]int, error)
- func InsertStringAt(x []string, y string, index int) ([]string, error)
- func InsertStringsAt(x []string, y []string, index int) ([]string, error)
- func InsertUInt64At(x []uint64, y uint64, index int) ([]uint64, error)
- func InsertUInt64sAt(x []uint64, y []uint64, index int) ([]uint64, error)
- func MergeInt64s(x []int64, y []int64, excludes ...int64) []int64
- func MergeInts(x []int, y []int, excludes ...int) []int
- func MergeStrings(x []string, y []string, excludes ...string) []string
- func MergeUInt64s(x []uint64, y []uint64, excludes ...uint64) []uint64
- func PopFirstInt(x []int) (int, []int, error)
- func PopFirstInt64(x []int64) (int64, []int64, error)
- func PopFirstString(x []string) (string, []string, error)
- func PopFirstUInt64(x []uint64) (uint64, []uint64, error)
- func PopLastInt(x []int) (int, []int, error)
- func PopLastInt64(x []int64) (int64, []int64, error)
- func PopLastString(x []string) (string, []string, error)
- func PopLastUInt64(x []uint64) (uint64, []uint64, error)
- func RemoveInt(x []int, y int) []int
- func RemoveInt64(x []int64, y int64) []int64
- func RemoveInt64At(x []int64, index int) ([]int64, error)
- func RemoveIntAt(x []int, index int) ([]int, error)
- func RemoveString(x []string, y string) []string
- func RemoveStringAt(x []string, index int) ([]string, error)
- func RemoveUInt64(x []uint64, y uint64) []uint64
- func RemoveUInt64At(x []uint64, index int) ([]uint64, error)
- func ReverseInt64s(x []int64) []int64
- func ReverseInts(x []int) []int
- func ReverseStrings(x []string) []string
- func ReverseUInt64s(x []uint64) []uint64
- func ShuffleInt64s(x []int64) []int64
- func ShuffleInts(x []int) []int
- func ShuffleStrings(x []string) []string
- func ShuffleUInt64s(x []uint64) []uint64
- func SumOfInt64s(x []int64) int64
- func SumOfInts(x []int) int
- func SumOfUInt64s(x []uint64) uint64
- func TransformInt64s(target, current []int64) (add, remove []int64)
- func TransformInts(target, current []int) (add, remove []int)
- func TransformStrings(target, current []string) (add, remove []string)
- func TransformUInt64s(target, current []uint64) (add, remove []uint64)
- func UniqueInt64s(x []int64) []int64
- func UniqueInts(x []int) []int
- func UniqueStrings(x []string) []string
- func UniqueUInt64s(x []uint64) []uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsInt ¶
ContainsInt checks whether an int element is in an int slice
func ContainsInt64 ¶
ContainsInt64 checks whether an int64 element is in an int64 slice
func ContainsString ¶
ContainsString checks whether a string element is in a string slice
func ContainsUInt64 ¶
ContainsUInt64 checks whether an uint64 element is in an uint64 slice
func CopyInt64s ¶
CopyInt64s makes a new int64 slice that copies the content of the given int64 slice
func CopyStrings ¶
CopyStrings makes a new string slice that copies the content of the given string slice
func CopyUInt64s ¶
CopyUInt64s makes a new uint64 slice that copies the content of the given uint64 slice
func CutInt64s ¶
CutInt64s cuts an int64 slice by removing the elements starts from i and ends at j-1
func CutStrings ¶
CutStrings cuts a string slice by removing the elements starts from i and ends at j-1
func CutUInt64s ¶
CutUInt64s cuts an uint64 slice by removing the elements starts from i and ends at j-1
func EqualsInt64s ¶
EqualsInt64s checks whether two int64 slice has the same elements
func EqualsInts ¶
EqualsInts checks whether two int slice has the same elements
func EqualsStrings ¶
EqualsStrings checks whether two string slice has the same elements
func EqualsUInt64s ¶
EqualsUInt64s checks whether two uint64 slice has the same elements
func FilterInt64s ¶
FilterInt64s filters an int64 slice by the given filter function
func FilterInts ¶
FilterInts filters an int slice by the given filter function
func FilterStrings ¶
FilterStrings filters a string slice by the given filter function
func FilterUInt64s ¶
FilterUInt64s filters an uint64 slice by the given filter function
func IndexOfInt ¶
IndexOfInt gets the index of an int element in an int slice
func IndexOfInt64 ¶
IndexOfInt64 gets the index of an int64 element in an int64 slice
func IndexOfString ¶
IndexOfString gets the index of a string element in a string slice
func IndexOfUInt64 ¶
IndexOfUInt64 gets the index of an uint64 element in an uint64 slice
func InsertInt64At ¶
InsertInt64At inserts an int64 value into a given int64 slice at given index
func InsertInt64sAt ¶
InsertInt64sAt inserts a int64 slice into a given int64 slice at given index
func InsertIntAt ¶
InsertIntAt inserts an int value into a given int slice at given index
func InsertIntsAt ¶
InsertIntsAt inserts a int slice into a given int slice at given index
func InsertStringAt ¶
InsertStringAt inserts a string value stringo a given string slice at given index
func InsertStringsAt ¶
InsertStringsAt inserts a string slice stringo a given string slice at given index
func InsertUInt64At ¶
InsertUInt64At inserts an uint64 value into a given uint64 slice at given index
func InsertUInt64sAt ¶
InsertUInt64sAt inserts a uint64 slice into a given uint64 slice at given index
func MergeInt64s ¶
MergeInt64s merges two int64 slice with specific excluded values
func MergeStrings ¶
MergeStrings merges two string slice with specific excluded values
func MergeUInt64s ¶
MergeUInt64s merges two uint64 slice with specific excluded values
func PopFirstInt ¶
PopFirstInt pops the first value of an int slice
func PopFirstInt64 ¶
PopFirstInt64 pops the first value of an int64 slice
func PopFirstString ¶
PopFirstString pops the first value of a string slice
func PopFirstUInt64 ¶
PopFirstUInt64 pops the first value of an uint64 slice
func PopLastInt ¶
PopLastInt pops the last value of an int slice
func PopLastInt64 ¶
PopLastInt64 pops the last value of an int64 slice
func PopLastString ¶
PopLastString pops the last value of a string slice
func PopLastUInt64 ¶
PopLastUInt64 pops the last value of an uint64 slice
func RemoveInt64 ¶
RemoveInt64 removes an int64 from a given int64 slice by value
func RemoveInt64At ¶
RemoveInt64At removes an int64 from a given int64 slice by index
func RemoveIntAt ¶
RemoveIntAt removes an int from a given int slice by index
func RemoveString ¶
RemoveString removes a string from a given string slice by value
func RemoveStringAt ¶
RemoveStringAt removes a string from a given string slice by index
func RemoveUInt64 ¶
RemoveUInt64 removes an uint64 from a given uint64 slice by value
func RemoveUInt64At ¶
RemoveUInt64At removes an uint64 from a given uint64 slice by index
func ReverseStrings ¶
ReverseStrings reverses a string slice
func ReverseUInt64s ¶
ReverseUInt64s reverses an uint64 slice
func ShuffleStrings ¶
ShuffleStrings shuffles a string slice
func ShuffleUInt64s ¶
ShuffleUInt64s shuffles an uint64 slice
func SumOfInt64s ¶
SumOfInt64s find the sum of all items in int64 slice
func SumOfUInt64s ¶
SumOfUInt64s find the sum of all items in uint64 slice
func TransformInt64s ¶
TransformInt64s helps figure out how to transform current to target slice by returning the ones to add and remove
func TransformInts ¶
TransformInts helps figure out how to transform current to target slice by returning the ones to add and remove
func TransformStrings ¶
TransformStrings helps figure out how to transform current to target slice by returning the ones to add and remove
func TransformUInt64s ¶
TransformUInt64s helps figure out how to transform current to target slice by returning the ones to add and remove
func UniqueInt64s ¶ added in v1.0.2
UniqueInt64s removes the duplicates from the int64 slice
func UniqueInts ¶ added in v1.0.2
UniqueInts removes the duplicates from the int slice
func UniqueStrings ¶
UniqueStrings removes the duplicates from the string slice
func UniqueUInt64s ¶ added in v1.0.2
UniqueUInt64s removes the duplicates from the uint64 slice
Types ¶
This section is empty.