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 ValidateErrors
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 ValidateErrors ¶ added in v0.7.0
type ValidateErrors []error
ValidateErrors 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 (ValidateErrors) Error ¶ added in v0.7.0
func (e ValidateErrors) Error() string
func (ValidateErrors) Return ¶ added in v0.7.0
func (e ValidateErrors) Return() error
Return returns nil, if no errors has been added.
Click to show internal directories.
Click to hide internal directories.