Documentation ¶
Overview ¶
Go programming helpers for common 'pseudo-generic' typed-slice needs.
Index ¶
- func BoolAppendUnique(ref *[]bool, v bool)
- func BoolAppendUniques(ref *[]bool, vals ...bool)
- func BoolAt(slice []bool, val bool) int
- func BoolConvert(src []interface{}, sparse bool) (dst []bool)
- func BoolEach(sl []bool, apply ...func(bool) bool) []bool
- func BoolEnsureCap(ref *[]bool, capacity int)
- func BoolEnsureLen(ref *[]bool, length int)
- func BoolEquivalent(one, two []bool) bool
- func BoolHas(slice []bool, val bool) bool
- func BoolHasAny(slice []bool, vals ...bool) bool
- func BoolRemove(ref *[]bool, v bool, all bool)
- func BoolSetCap(ref *[]bool, capacity int)
- func BoolSetLen(ref *[]bool, length int)
- func BoolWithout(slice []bool, keepOrder bool, withoutVals ...bool) []bool
- func F64AppendUnique(ref *[]float64, v float64)
- func F64AppendUniques(ref *[]float64, vals ...float64)
- func F64At(slice []float64, val float64) int
- func F64Convert(src []interface{}, sparse bool) (dst []float64)
- func F64Each(sl []float64, apply ...func(float64) float64) []float64
- func F64EnsureCap(ref *[]float64, capacity int)
- func F64EnsureLen(ref *[]float64, length int)
- func F64Equivalent(one, two []float64) bool
- func F64Has(slice []float64, val float64) bool
- func F64HasAny(slice []float64, vals ...float64) bool
- func F64Remove(ref *[]float64, v float64, all bool)
- func F64SetCap(ref *[]float64, capacity int)
- func F64SetLen(ref *[]float64, length int)
- func F64Without(slice []float64, keepOrder bool, withoutVals ...float64) []float64
- func IntAppendUnique(ref *[]int, v int)
- func IntAppendUniques(ref *[]int, vals ...int)
- func IntAt(slice []int, val int) int
- func IntConvert(src []interface{}, sparse bool) (dst []int)
- func IntEach(sl []int, apply ...func(int) int) []int
- func IntEnsureCap(ref *[]int, capacity int)
- func IntEnsureLen(ref *[]int, length int)
- func IntEquivalent(one, two []int) bool
- func IntHas(slice []int, val int) bool
- func IntHasAny(slice []int, vals ...int) bool
- func IntRemove(ref *[]int, v int, all bool)
- func IntSetCap(ref *[]int, capacity int)
- func IntSetLen(ref *[]int, length int)
- func IntWithout(slice []int, keepOrder bool, withoutVals ...int) []int
- func StrAppendUnique(ref *[]string, v string)
- func StrAppendUniques(ref *[]string, vals ...string)
- func StrAt(slice []string, val string) int
- func StrAtIgnoreCase(vals []string, val string) int
- func StrConvert(src []interface{}, sparse bool) (dst []string)
- func StrEach(sl []string, apply ...func(string) string) []string
- func StrEnsureCap(ref *[]string, capacity int)
- func StrEnsureLen(ref *[]string, length int)
- func StrEq(s1, s2 []string) bool
- func StrEquivalent(one, two []string) bool
- func StrFiltered(vals []string, check func(string) bool) (items []string)
- func StrHas(slice []string, val string) bool
- func StrHasAny(slice []string, vals ...string) bool
- func StrHasIgnoreCase(vals []string, val string) bool
- func StrMap(vals []string, strmap func(string) string) (items []string)
- func StrRemove(ref *[]string, v string, all bool)
- func StrReverse(v []string) []string
- func StrSetCap(ref *[]string, capacity int)
- func StrSetLen(ref *[]string, length int)
- func StrShortest(v []string) (shortest string)
- func StrWithFewest(v []string, substr string, otherwise func([]string) string) (found string)
- func StrWithout(slice []string, keepOrder bool, withoutVals ...string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolAppendUnique ¶
Appends `v` to `*ref` only if `*ref` does not already contain `v`.
func BoolAppendUniques ¶
Appends each value in `vals` to `*ref` only `*ref` does not already contain it.
func BoolConvert ¶
Converts `src` to `dst`.
If `sparse` is `true`, then only successfully converted `bool` values are placed in `dst`, so there may not be a 1-to-1 correspondence of `dst` to `src` in length or indices.
If `sparse` is `false`, `dst` has the same length as `src` and non-convertable values remain zeroed.
func BoolEach ¶
Sets each `bool` in `sl` to the result of passing it to each `apply` func. Although `sl` is modified in-place, it is also returned for convenience.
func BoolEnsureCap ¶
Calls `BoolSetCap` only if the current `cap(*ref)` is less than the specified `capacity`.
func BoolEnsureLen ¶
Calls `BoolSetLen` only if the current `len(*ref)` is less than the specified `length`.
func BoolEquivalent ¶
Returns whether `one` and `two` only contain identical values, regardless of ordering.
func BoolHasAny ¶
Returns whether at least one of the specified `vals` is contained in `slice`.
func BoolRemove ¶
Removes the first occurrence of `v` encountered in `*ref`, or all occurrences if `all` is `true`.
func BoolSetCap ¶
Sets `*ref` to a copy of `*ref` with the specified `capacity`.
func BoolSetLen ¶
Sets `*ref` to a copy of `*ref` with the specified `length`.
func BoolWithout ¶
Removes all specified `withoutVals` from `slice`.
func F64AppendUnique ¶
Appends `v` to `*ref` only if `*ref` does not already contain `v`.
func F64AppendUniques ¶
Appends each value in `vals` to `*ref` only `*ref` does not already contain it.
func F64Convert ¶
Converts `src` to `dst`.
If `sparse` is `true`, then only successfully converted `float64` values are placed in `dst`, so there may not be a 1-to-1 correspondence of `dst` to `src` in length or indices.
If `sparse` is `false`, `dst` has the same length as `src` and non-convertable values remain zeroed.
func F64Each ¶
Sets each `float64` in `sl` to the result of passing it to each `apply` func. Although `sl` is modified in-place, it is also returned for convenience.
func F64EnsureCap ¶
Calls `F64SetCap` only if the current `cap(*ref)` is less than the specified `capacity`.
func F64EnsureLen ¶
Calls `F64SetLen` only if the current `len(*ref)` is less than the specified `length`.
func F64Equivalent ¶
Returns whether `one` and `two` only contain identical values, regardless of ordering.
func F64Remove ¶
Removes the first occurrence of `v` encountered in `*ref`, or all occurrences if `all` is `true`.
func F64Without ¶
Removes all specified `withoutVals` from `slice`.
func IntAppendUnique ¶
Appends `v` to `*ref` only if `*ref` does not already contain `v`.
func IntAppendUniques ¶
Appends each value in `vals` to `*ref` only `*ref` does not already contain it.
func IntConvert ¶
Converts `src` to `dst`.
If `sparse` is `true`, then only successfully converted `int` values are placed in `dst`, so there may not be a 1-to-1 correspondence of `dst` to `src` in length or indices.
If `sparse` is `false`, `dst` has the same length as `src` and non-convertable values remain zeroed.
func IntEach ¶
Sets each `int` in `sl` to the result of passing it to each `apply` func. Although `sl` is modified in-place, it is also returned for convenience.
func IntEnsureCap ¶
Calls `IntSetCap` only if the current `cap(*ref)` is less than the specified `capacity`.
func IntEnsureLen ¶
Calls `IntSetLen` only if the current `len(*ref)` is less than the specified `length`.
func IntEquivalent ¶
Returns whether `one` and `two` only contain identical values, regardless of ordering.
func IntRemove ¶
Removes the first occurrence of `v` encountered in `*ref`, or all occurrences if `all` is `true`.
func IntWithout ¶
Removes all specified `withoutVals` from `slice`.
func StrAppendUnique ¶
Appends `v` to `*ref` only if `*ref` does not already contain `v`.
func StrAppendUniques ¶
Appends each value in `vals` to `*ref` only `*ref` does not already contain it.
func StrAtIgnoreCase ¶
Returns the position of lower-case `val` in lower-case `vals`.
func StrConvert ¶
Converts `src` to `dst`.
If `sparse` is `true`, then only successfully converted `string` values are placed in `dst`, so there may not be a 1-to-1 correspondence of `dst` to `src` in length or indices.
If `sparse` is `false`, `dst` has the same length as `src` and non-convertable values remain zeroed.
func StrEach ¶
Sets each `string` in `sl` to the result of passing it to each `apply` func. Although `sl` is modified in-place, it is also returned for convenience.
func StrEnsureCap ¶
Calls `StrSetCap` only if the current `cap(*ref)` is less than the specified `capacity`.
func StrEnsureLen ¶
Calls `StrSetLen` only if the current `len(*ref)` is less than the specified `length`.
func StrEquivalent ¶
Returns whether `one` and `two` only contain identical values, regardless of ordering.
func StrHasIgnoreCase ¶
Returns whether lower-case `val` is in lower-case `vals`.
func StrRemove ¶
Removes the first occurrence of `v` encountered in `*ref`, or all occurrences if `all` is `true`.
func StrReverse ¶
func StrShortest ¶
func StrWithFewest ¶
Types ¶
This section is empty.