util

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelOnInterrupt

func CancelOnInterrupt(ctx context.Context) context.Context

CancelOnInterrupt creates a context and calls the context cancel function when an interrupt signal is caught

func IsMaxRetries

func IsMaxRetries(err error) bool

IsMaxRetries checks whether the error is due to hitting the maximum number of retries or not.

func OrStrings

func OrStrings(strs ...string) string

OrStrings returns the first non empty string in its arguments

func Retry

func Retry(fn Func, maxRetries int) error

Retry keeps trying the function until the second argument returns false, or no error is returned.

Types

type Func

type Func func(attempt int) (retry bool, err error)

Func represents functions that can be retried.

Jump to

Keyboard shortcuts

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