Documentation ¶
Index ¶
- Variables
- func Contains[T comparable](haystack []T, needle T) bool
- func ContainsFloat(haystack []float64, needle float64) bool
- func ContainsInt(haystack []int, needle int) bool
- func ContainsString(haystack []string, needle string) bool
- func IntToString(in []int) []string
- func Max[T constraints.Ordered](haystack []T) T
- func MedianFloats(in []float64) float64
- func MedianInts(in []int) int
- func StringToInt(in []string) []int
- func Sum[T constraints.Ordered](haystack []T) T
- func SumFloats(in []float64) float64
- func SumInts(in []int) int
- func ToInterface[T any](in []T) []interface{}
- func UInt64ToString(in []uint64) []string
- func Unique[T comparable](in []T) []T
- func UniqueInt(in []int) []int
- func UniqueString(in []string, allowEmpty bool) []string
- type BoolStack
- type FloatStack
- type IntStack
- type Stack
- type StringStack
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrStackEmpty = errors.New("stack is empty")
)
Functions ¶
func Contains ¶ added in v1.1.35
func Contains[T comparable](haystack []T, needle T) bool
func ContainsFloat ¶
ContainsFloat returns true if float needle is an element in float slice haystack
func ContainsInt ¶
ContainsInt returns true if int needle is an element in int slice haystack
func ContainsString ¶
ContainsString returns true if string needle is an element in string slice haystack
func IntToString ¶ added in v1.1.15
IntToString takes a slice of int and returns a slice of string.
func Max ¶ added in v1.1.41
func Max[T constraints.Ordered](haystack []T) T
func MedianFloats ¶
MedianFloats gets the median number in the given slice of float64.
func MedianInts ¶
MedianInts gets the median number in the given slice of ints.
func StringToInt ¶
StringToInt takes a slice of string and returns a slice of int.
func Sum ¶ added in v1.1.42
func Sum[T constraints.Ordered](haystack []T) T
func ToInterface ¶ added in v1.1.32
func ToInterface[T any](in []T) []interface{}
func UInt64ToString ¶ added in v1.1.47
IntToString takes a slice of int and returns a slice of string.
func Unique ¶ added in v1.1.32
func Unique[T comparable](in []T) []T
func UniqueString ¶
UniqueString takes a slice of string and returns a slice with only unique elements.
Types ¶
type BoolStack ¶ added in v1.1.25
type BoolStack struct {
// contains filtered or unexported fields
}
type FloatStack ¶ added in v1.1.25
type FloatStack struct {
// contains filtered or unexported fields
}
func (*FloatStack) Len ¶ added in v1.1.25
func (s *FloatStack) Len() int
func (*FloatStack) Peek ¶ added in v1.1.25
func (s *FloatStack) Peek() (float64, error)
func (*FloatStack) Pop ¶ added in v1.1.25
func (s *FloatStack) Pop() (float64, error)
func (*FloatStack) Push ¶ added in v1.1.25
func (s *FloatStack) Push(i float64)
type Stack ¶ added in v1.1.44
type Stack[T any] struct { // contains filtered or unexported fields }
type StringStack ¶ added in v1.1.25
type StringStack struct {
// contains filtered or unexported fields
}
func (*StringStack) Len ¶ added in v1.1.25
func (s *StringStack) Len() int
func (*StringStack) Peek ¶ added in v1.1.25
func (s *StringStack) Peek() (string, error)
func (*StringStack) Pop ¶ added in v1.1.25
func (s *StringStack) Pop() (string, error)
func (*StringStack) Push ¶ added in v1.1.25
func (s *StringStack) Push(i string)
Click to show internal directories.
Click to hide internal directories.