utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten(thing map[string]interface{}) (map[string]string, error)

Flatten takes a structure and turns into a flat map[string]string.

Within the "thing" parameter, only primitive values are allowed. Structs are not supported. Therefore, it can only be slices, maps, primitives, and any combination of those together.

See the tests for examples of what inputs are turned into.

func FormatAsTable

func FormatAsTable(entries []string, header string) (string, error)

FormatAsTable formats the given string entries as table where the header string defines the column titles.

func Ticker

func Ticker(runner func(), done chan bool, interval time.Duration)

Ticker always executes the runner function after the interval has expired. Every message on the done channel will stop the execution. Please note that this function will block until it receives the done message.

func WaitTimeout

func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool

WaitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out.

func WriteSorted

func WriteSorted(entries []string, writer io.Writer) error

WriteSorted writes all elements from entries sorted into the given writer.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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