util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package util provides very generic helpers used across codebase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent

func Indent(text, indent string) string

Indent indents a block of text with an indent string.

func JoinSorted

func JoinSorted(values map[string]string, valueSeparator string, keySeparator string) string

JoinSorted takes map of keys and values, sorts them by keys and joins with given separators.

func KeysStringMap

func KeysStringMap(m map[string]string) []string

KeysStringMap returns keys from given map.

func PickInt

func PickInt(values ...int) int

PickInt returns first non-zero integer passed.

func PickString

func PickString(values ...string) string

PickString returns first non-empty string passed.

func PickStringMap

func PickStringMap(values ...map[string]string) map[string]string

PickStringMap returns first non-empty map of strings.

func PickStringSlice

func PickStringSlice(values ...[]string) []string

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.

Jump to

Keyboard shortcuts

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