Documentation ¶
Overview ¶
Package util provides very generic helpers used across codebase.
Index ¶
- func ColorizeDiff(diff string) string
- func Indent(text, indent string) string
- func JoinSorted(values map[string]string, valueSeparator, keySeparator string) string
- func KeysStringMap(m map[string]string) []string
- func PickInt(values ...int) int
- func PickString(values ...string) string
- func PickStringMap(values ...map[string]string) map[string]string
- func PickStringSlice(values ...[]string) []string
- type ValidateError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorizeDiff ¶ added in v0.3.1
ColorizeDiff takes diff-formatter output and adds console colors to it.
func JoinSorted ¶
JoinSorted takes map of keys and values, sorts them by keys and joins with given separators.
func KeysStringMap ¶
KeysStringMap returns keys from given map.
func PickString ¶
PickString returns first non-empty string passed.
func PickStringMap ¶
PickStringMap returns first non-empty map of strings.
func PickStringSlice ¶
PickStringSlice returns first non-empty strings slice.
Types ¶
type ValidateError ¶ added in v0.2.0
type ValidateError []error
ValidateError is a collection of errors, which can be used when performing validation of structs to collect all possible errors and return them in one batch.
func (ValidateError) Error ¶ added in v0.2.0
func (e ValidateError) Error() string
func (ValidateError) Return ¶ added in v0.2.0
func (e ValidateError) Return() error
Return returns nil, if no errors has been added.
Click to show internal directories.
Click to hide internal directories.