util

package
v0.8.0-dev Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YYMMDDTimeFormat = "2006-01-02"
)

Variables

View Source
var (
	ErrTimeout = errors.New("timeout exceeded")
)

Functions

func FirstParsedTime

func FirstParsedTime(v string, formats ...string) time.Time

FirstParsedTime attempts to parse v with all provided formats in order. The first parsed time.Time that doesn't error is returned.

func Or

func Or(options ...string) string

Or returns the first non-empty string

func Timeout

func Timeout(f func() error, t time.Duration) error

Timeout will attempt to call f, but only for as long as t. If the function is still processing after t has elapsed then ErrTimeout will be returned.

func Yes

func Yes(in string) bool

Yes returns true if the provided case-insensitive string matches 'yes' and is used to parse config values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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