Documentation ¶
Index ¶
- Constants
- Variables
- func ByteCountSI(b int64) string
- func Contains(v string, l []string) bool
- func ContainsList(v []string, l []string) bool
- func DirExists(path string) (bool, error)
- func DirSize(path string) (int64, error)
- func Download(ctx context.Context, source, destination string) error
- func FileExists(filename string) (bool, error)
- func MergeStringMaps(a, b map[string]string) map[string]string
- func Random(length int) string
- func RandomWithCharset(length int, charset string) string
- func Retry(ctx context.Context, attempts int, jitter bool, minInterval time.Duration, ...) error
- func RetryWithTimeout(ctx context.Context, timeout, interval time.Duration, retryFn RetryFunc) error
- func Sleep(ctx context.Context, sleep time.Duration) bool
- func SortSemverVersions(versions []string) ([]string, error)
- func TempDirName() string
- func TouchFile(path string) error
- func WaitForFile(ctx context.Context, path string, timeout time.Duration) error
- func YAMLDocuments(reader io.Reader) ([]string, error)
- type RetryFunc
Constants ¶
View Source
const (
// DefaultCharSet is the default charset to use
DefaultCharSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)
View Source
const (
// MaxAttempts is the max attempts
MaxAttempts = 99999999
)
Variables ¶
View Source
var ( // ErrCancelled indicates the operation was cancelled ErrCancelled = errors.New("operation cancelled") // ErrReachMaxAttempts indicates we hit the limit ErrReachMaxAttempts = errors.New("reached max attempts") )
Functions ¶
func ByteCountSI ¶
ByteCountSI returns the number of bytes in the given number of SI units.
func ContainsList ¶
ContainsList checks a list has a value in it
func MergeStringMaps ¶
MergeStringMaps merges maps together
func RandomWithCharset ¶
RandomWithCharset returns a random string of x charset
func Retry ¶
func Retry(ctx context.Context, attempts int, jitter bool, minInterval time.Duration, retryFn RetryFunc) error
Retry is used to retry an operation multiple times under a context. If the retryFn returns false with no error, the operation will be retried.
func RetryWithTimeout ¶
func RetryWithTimeout(ctx context.Context, timeout, interval time.Duration, retryFn RetryFunc) error
RetryWithTimeout creates a retry with a specific timeout
func SortSemverVersions ¶
SortSemverVersions sorts a list of semver versions in ascending order.
func WaitForFile ¶
WaitForFile waits for a file to exist or times out
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.