Documentation ¶
Overview ¶
Package utils contains general purpose functions and helpers used in many packages.
Index ¶
- Variables
- func IsAlphaNumeric(s string) bool
- type HealthJobNoop
- func (HealthJobNoop) Event(eventName string)
- func (HealthJobNoop) EventErr(eventName string, err error) error
- func (HealthJobNoop) EventErrKv(eventName string, err error, kvs map[string]string) error
- func (HealthJobNoop) EventKv(eventName string, kvs map[string]string)
- func (HealthJobNoop) Timing(eventName string, nanoseconds int64)
- func (HealthJobNoop) TimingKv(eventName string, nanoseconds int64, kvs map[string]string)
- type Int64Slice
- func (l Int64Slice) All(f func(int64) bool) bool
- func (l Int64Slice) Any(f func(int64) bool) bool
- func (l *Int64Slice) Append(s ...int64) Int64Slice
- func (l *Int64Slice) Delete(i int) error
- func (l Int64Slice) Include(t int64) bool
- func (l Int64Slice) Index(t int64) int
- func (l Int64Slice) Len() int
- func (l Int64Slice) Less(i, j int) bool
- func (l *Int64Slice) Map(f func(int64) int64) Int64Slice
- func (l *Int64Slice) Reduce(f func(int64) bool) Int64Slice
- func (l Int64Slice) Reverse() Int64Slice
- func (l Int64Slice) Sort() Int64Slice
- func (l Int64Slice) Sum() int64
- func (l Int64Slice) Swap(i, j int)
- func (l Int64Slice) ToInt64() []int64
- func (l *Int64Slice) Unique() Int64Slice
- func (l *Int64Slice) Update(i int, s int64) error
- type StringSlice
- func (l StringSlice) All(f func(string) bool) bool
- func (l StringSlice) Any(f func(string) bool) bool
- func (l *StringSlice) Append(s ...string) StringSlice
- func (l *StringSlice) Delete(i int) error
- func (l StringSlice) Filter(f func(string) bool) StringSlice
- func (l StringSlice) Include(t string) bool
- func (l StringSlice) Index(t string) int
- func (l StringSlice) Join(sep string) string
- func (l StringSlice) Len() int
- func (l StringSlice) Less(i, j int) bool
- func (l *StringSlice) Map(f func(string) string) StringSlice
- func (l *StringSlice) Reduce(f func(string) bool) StringSlice
- func (l *StringSlice) ReduceContains(in ...string) StringSlice
- func (l *StringSlice) Shuffle() StringSlice
- func (l StringSlice) Sort() StringSlice
- func (l *StringSlice) Split(s, sep string) StringSlice
- func (l *StringSlice) SplitStringer8(n string, ps ...uint8) StringSlice
- func (l StringSlice) Swap(i, j int)
- func (l StringSlice) ToString() []string
- func (l *StringSlice) Unique() StringSlice
- func (l *StringSlice) Update(i int, s string) error
Constants ¶
This section is empty.
Variables ¶
var ErrOutOfRange = errors.New("Out of range")
Functions ¶
func IsAlphaNumeric ¶
IsAlphaNumeric returns true if a string consists of characters a-zA-Z0-9_
Types ¶
type HealthJobNoop ¶
type HealthJobNoop struct{}
HealthJobNoop default Job for the health.EventReceiver
func (HealthJobNoop) Event ¶
func (HealthJobNoop) Event(eventName string)
func (HealthJobNoop) EventErrKv ¶
func (HealthJobNoop) EventKv ¶
func (HealthJobNoop) EventKv(eventName string, kvs map[string]string)
func (HealthJobNoop) Timing ¶
func (HealthJobNoop) Timing(eventName string, nanoseconds int64)
type Int64Slice ¶
type Int64Slice []int64
Int64Slice contains Map/Filter/Reduce/Sort/Unique/etc method receivers for []int64. @todo think about the necessary gen functions +gen slice:"Where,Count,GroupBy[int64]"
func (Int64Slice) All ¶
func (l Int64Slice) All(f func(int64) bool) bool
All returns true if all of the int64s in the slice satisfy the predicate f.
func (Int64Slice) Any ¶
func (l Int64Slice) Any(f func(int64) bool) bool
Any returns true if one of the int64s in the slice satisfies the predicate f.
func (*Int64Slice) Append ¶
func (l *Int64Slice) Append(s ...int64) Int64Slice
Append adds s (variadic) to the Int64Slice
func (*Int64Slice) Delete ¶
func (l *Int64Slice) Delete(i int) error
Delete removes index i from slice
func (Int64Slice) Include ¶
func (l Int64Slice) Include(t int64) bool
Include returns true if the target int64 t is in the slice.
func (Int64Slice) Index ¶
func (l Int64Slice) Index(t int64) int
Index returns -1 if not found or the current index for target t.
func (*Int64Slice) Map ¶
func (l *Int64Slice) Map(f func(int64) int64) Int64Slice
Map changes itself containing the results of applying the function f to each int64 in itself.
func (*Int64Slice) Reduce ¶
func (l *Int64Slice) Reduce(f func(int64) bool) Int64Slice
Reduce reduces itself containing all int64s in the slice that satisfy the predicate f.
func (Int64Slice) Reverse ¶
func (l Int64Slice) Reverse() Int64Slice
Reverse is a convenience method.
func (Int64Slice) ToInt64 ¶
func (l Int64Slice) ToInt64() []int64
ToInt64 converts to type int64 slice.
func (*Int64Slice) Unique ¶
func (l *Int64Slice) Unique() Int64Slice
Unique removes duplicate entries.
type StringSlice ¶
type StringSlice []string
StringSlice contains Map/Filter/Reduce/Sort/Unique/etc method receivers for []string.
func (StringSlice) All ¶
func (l StringSlice) All(f func(string) bool) bool
All returns true if all of the strings in the slice satisfy the predicate f.
func (StringSlice) Any ¶
func (l StringSlice) Any(f func(string) bool) bool
Any returns true if one of the strings in the slice satisfies the predicate f.
func (*StringSlice) Append ¶
func (l *StringSlice) Append(s ...string) StringSlice
Append adds s (variadic) to the StringSlice
func (*StringSlice) Delete ¶
func (l *StringSlice) Delete(i int) error
Delete removes index i from slice
func (StringSlice) Filter ¶
func (l StringSlice) Filter(f func(string) bool) StringSlice
Filter filters all strings in the slice that satisfy the predicate f and returns a new slice
func (StringSlice) Include ¶
func (l StringSlice) Include(t string) bool
Include returns true if the target string t is in the slice.
func (StringSlice) Index ¶
func (l StringSlice) Index(t string) int
Index returns -1 if not found or the current index for target t.
func (StringSlice) Join ¶
func (l StringSlice) Join(sep string) string
Join joins the slice using a separator
func (*StringSlice) Map ¶
func (l *StringSlice) Map(f func(string) string) StringSlice
Map changes itself containing the results of applying the function f to each string in itself.
func (*StringSlice) Reduce ¶
func (l *StringSlice) Reduce(f func(string) bool) StringSlice
Reduce reduces itself containing all strings in the slice that satisfy the predicate f.
func (*StringSlice) ReduceContains ¶
func (l *StringSlice) ReduceContains(in ...string) StringSlice
ReduceContains reduces itself if the parts of the in slice are contained within itself.
func (*StringSlice) Shuffle ¶
func (l *StringSlice) Shuffle() StringSlice
Shuffle destroys the order
func (*StringSlice) Split ¶
func (l *StringSlice) Split(s, sep string) StringSlice
Split uses string s and a separator and appends the parts to the slice.
func (*StringSlice) SplitStringer8 ¶
func (l *StringSlice) SplitStringer8(n string, ps ...uint8) StringSlice
SplitStringer uses a name and position indexes to split the name and appends the parts to the slice. Cracking the names and indexes which the stringer command generates.
func (StringSlice) ToString ¶
func (l StringSlice) ToString() []string
ToString converts to string slice.
func (*StringSlice) Unique ¶
func (l *StringSlice) Unique() StringSlice
Unique removes duplicate entries and discards "" empty strings.