Documentation ¶
Index ¶
- func ArrayContains[T comparable](arr []T, value T) bool
- func ArrayExcluding[T comparable](arr []T, valueToExclude ...T) []T
- func ArrayIntersection[T comparable](firstArray []T, secondArray []T) []T
- func ArrayMap[V any, R any](arr []V, mappingFunc func(V) R) []R
- func ExtractObject(object any, path ...string) (any, error)
- func GetFreePort() (int, error)
- func GetFreePorts(count int) ([]int, error)
- func GetPort() int
- func HashAny(value interface{}) (uint64, error)
- func HashBytes(payload []byte) [16]byte
- func HashString(value string) [16]byte
- func IsLetterOrNumber(symbol int32) bool
- func IsNumber(symbol int32) bool
- func JoinNonEmptyStrings(sep string, elems ...string) string
- func MapClear[K comparable, V any](mp map[K]V)
- func MapCopy[K comparable, V any](mp map[K]V) map[K]V
- func MapHasSameKeys[K comparable, V any, J any](a map[K]V, b map[K]J) bool
- func MapNVL[K comparable, V any](mp map[K]V, key K, defaultValue V) V
- func MapNVLFunc[K comparable, V any](mp map[K]V, key K, defaultFunc func() V) V
- func MapNVLKeys[K comparable, V any](mp map[K]V, keys ...K) V
- func MapPutAll[K comparable, V any](destination map[K]V, source map[K]V) map[K]V
- func MapPutIfAbsent[K comparable, V any](mp map[K]V, key K, value V) bool
- func MapToSlice[K comparable, V any, R any](mp map[K]V, mappingFunc func(K, V) R) []R
- func MaxDuration(a, b time.Duration) time.Duration
- func MaxInt(a, b int) int
- func Nvl[T comparable](args ...T) T
- func NvlMap(args ...map[string]any) map[string]any
- func NvlString(args ...string) string
- func ParseBool(value any) (bool, error)
- func ParseFloat(value any) (float64, error)
- func ParseInt(value any) (int, error)
- func ParseObject[K any](inputObject any, result *K) error
- func ParseString(value any) (string, error)
- func SanitizeString(str string) string
- func ShortenString(str string, n int) string
- func ShortenStringWithEllipsis(str string, n int) string
- type RichError
- type Set
- func (s Set[K]) Clear()
- func (s Set[K]) Clone() Set[K]
- func (s Set[K]) Contains(key K) bool
- func (s Set[K]) Equals(other Set[K]) bool
- func (s Set[K]) Put(key K)
- func (s Set[K]) PutAll(keys []K)
- func (s Set[K]) PutAllKeys(m map[K]any)
- func (s Set[K]) PutSet(keys Set[K])
- func (s Set[K]) Remove(key K)
- func (s Set[K]) ToSlice() []K
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayContains ¶
func ArrayContains[T comparable](arr []T, value T) bool
func ArrayExcluding ¶
func ArrayExcluding[T comparable](arr []T, valueToExclude ...T) []T
func ArrayIntersection ¶
func ArrayIntersection[T comparable](firstArray []T, secondArray []T) []T
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use.
func GetFreePorts ¶
GetFreePort asks the kernel for free open ports that are ready to use.
func GetPort ¶
func GetPort() int
GetPort is deprecated, use GetFreePort instead Ask the kernel for a free open port that is ready to use
func HashString ¶
func IsLetterOrNumber ¶
IsLetterOrNumber returns true if input symbol is:
A - Z: 65-90 a - z: 97-122
func JoinNonEmptyStrings ¶
JoinNonEmptyStrings joins strings with separator, but ignoring empty strings
func MapClear ¶
func MapClear[K comparable, V any](mp map[K]V)
func MapHasSameKeys ¶
func MapHasSameKeys[K comparable, V any, J any](a map[K]V, b map[K]J) bool
func MapNVL ¶
func MapNVL[K comparable, V any](mp map[K]V, key K, defaultValue V) V
func MapNVLFunc ¶
func MapNVLFunc[K comparable, V any](mp map[K]V, key K, defaultFunc func() V) V
func MapNVLKeys ¶
func MapNVLKeys[K comparable, V any](mp map[K]V, keys ...K) V
MapNVLKeys returns value by first key that exists or empty value of V type if no keys exist
func MapPutAll ¶
func MapPutAll[K comparable, V any](destination map[K]V, source map[K]V) map[K]V
func MapPutIfAbsent ¶
func MapPutIfAbsent[K comparable, V any](mp map[K]V, key K, value V) bool
MapPutIfAbsent puts value into map if key doesn't exist. Returns true if value was put
func MapToSlice ¶
func MapToSlice[K comparable, V any, R any](mp map[K]V, mappingFunc func(K, V) R) []R
func Nvl ¶
func Nvl[T comparable](args ...T) T
Nvl returns first not null object or pointer from varargs
return nil if all passed arguments are nil
func NvlMap ¶
NvlMap returns first not empty map from varargs
return nil if all passed maps are empty
func NvlString ¶
NvlString returns first not empty string value from varargs
return "" if all strings are empty
func ParseFloat ¶
ParseFloat parses value of string, int, integer float into float64.
func ParseObject ¶
ParseObject parses struct of any type from input object that can be:
map, json string or yaml string,
already struct of provided type or pointer to it
func ParseString ¶
ParseString parses value of string - effectively strict type checking.
func SanitizeString ¶
SanitizeString returns string with only alphanumeric characters and underscores
func ShortenString ¶
ShortenString returns the first N slice of a string.
func ShortenStringWithEllipsis ¶
ShortenStringWithEllipsis returns the first N slice of a string and ends with ellipsis.
Types ¶
type RichError ¶
type RichError struct {
// contains filtered or unexported fields
}
func NewRichError ¶
type Set ¶
type Set[K comparable] map[K]struct{}
func NewSet ¶
func NewSet[K comparable](values ...K) Set[K]