utils

package
v0.0.0-...-8aeb8a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains(arr []interface{}, value interface{}) bool

func ExtractObject

func ExtractObject(object interface{}, path ...string) (interface{}, error)

func MapKeysToString

func MapKeysToString(v interface{}) interface{}

MapKeysToString recursively traverses passed object if it is map or slice and converts all map[interface{}]interface{} objects to map[string]interface{} that may be necessary for json marshalling of objects extracted from yaml

func MapNVLKeys

func MapNVLKeys(mp map[string]interface{}, defaultValue interface{}, keys ...string) interface{}

MapNVLKeys returns value by first key that exists or empty value of V type if no keys exist

func MapNestedKeysToString

func MapNestedKeysToString(m map[string]interface{}) map[string]interface{}

MapNestedKeysToString recursively traverses passed map and converts all nested map[interface{}]interface{} objects to map[string]interface{} that may be necessary for json marshalling of objects extracted from yaml

func MapPutAll

func MapPutAll(destination map[string]interface{}, source map[string]interface{})

func Nvl

func Nvl(args ...interface{}) interface{}

Nvl returns first not null object or pointer from varargs

return nil if all passed arguments are nil

func NvlFloat

func NvlFloat(args ...float64) float64

func NvlInt

func NvlInt(args ...int) int

func NvlMap

func NvlMap(args ...map[string]interface{}) map[string]interface{}

NvlMap returns first not empty map from varargs

return nil if all passed maps are empty

func NvlString

func NvlString(args ...string) string

NvlString returns first not empty string value from varargs

return "" if all strings are empty

func ShortenString

func ShortenString(str string, n int) string

ShortenString returns the first N slice of a string.

func ShortenStringWithEllipsis

func ShortenStringWithEllipsis(str string, n int) string

ShortenStringWithEllipsis returns the first N slice of a string and ends with ellipsis.

func StringMapPutAll

func StringMapPutAll(destination map[string]string, source map[string]string)

Types

type RichError

type RichError struct {
	// contains filtered or unexported fields
}

func NewRichError

func NewRichError(error string, payload interface{}) *RichError

func (*RichError) Error

func (r *RichError) Error() string

func (*RichError) Payload

func (r *RichError) Payload() interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL