Documentation ¶
Index ¶
- func DefaultNumber[T Number](values ...T) T
- func DefaultStr(values ...string) string
- func EquivalentVersion(a string, b string) bool
- func GetOrDefault(str string, defaultStr string) string
- func GetVersionTag(imageDescriptor string) string
- func IntSliceContains(s []int, e int) bool
- func IsDirEmpty(name string) (bool, error)
- func IsValidFor(actual string, minimum string) bool
- func LabelToMap(label string) map[string]string
- func LessRecentThanVersion(a string, b string) bool
- func MoreRecentThanVersion(a string, b string) bool
- func NewSpinner(message string, maxRetries int, function func() error) error
- func RandomId(length int) string
- func ReadUsername() string
- func RegexpStringSliceContains(s []string, e string) bool
- func Retry(interval time.Duration, maxRetries int, f ConditionFunc) error
- func RetryError(interval time.Duration, maxRetries int, f CheckedFunc) error
- func RetryErrorWithContext(ctx context.Context, interval time.Duration, f CheckedFunc) error
- func RetryWithContext(ctx context.Context, interval time.Duration, f ConditionFunc) error
- func StringSliceContains(s []string, e string) bool
- func StringSliceEndsWith(s []string, e string) bool
- func StringSlicesEqual(a, b []string) bool
- func StringifySelector(labels map[string]string) string
- func TcpPortInUse(host string, port int) bool
- func TcpPortNextFree(startPort int) (int, error)
- func TryUntil(maxWindowTime time.Duration, f ResultFunc) (interface{}, error)
- type CheckedFunc
- type ConditionFunc
- type Number
- type Result
- type ResultFunc
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNumber ¶
func DefaultNumber[T Number](values ...T) T
func DefaultStr ¶
DefaultStr returns the first non-empty string
func EquivalentVersion ¶
func GetOrDefault ¶
func GetVersionTag ¶
func IntSliceContains ¶
func IsDirEmpty ¶
func IsValidFor ¶
func LabelToMap ¶
LabelToMap expects label string to be a comma separated list of key and value pairs delimited by equals.
func LessRecentThanVersion ¶
func MoreRecentThanVersion ¶
func ReadUsername ¶
func ReadUsername() string
func Retry ¶
func Retry(interval time.Duration, maxRetries int, f ConditionFunc) error
Retry retries f every interval until after maxRetries.
The interval won't be affected by how long f takes. For example, if interval is 3s, f takes 1s, another f will be called 2s later. However, if f takes longer than interval, it will be delayed.
If an error is received from f, fail immediately and return that error (no further retries).
Keep in mind that the second argument is for max _retries_. So, with a value of 1, f() will run at most 2 times (one try and one _retry_).
func RetryError ¶
func RetryError(interval time.Duration, maxRetries int, f CheckedFunc) error
This is similar to Retry(), but it will not fail immediately on errors, and if the retries are exhausted and f() still failing, it will return f()'s error
func RetryErrorWithContext ¶
RetryErrorWithContext will retry as long the checked function is returning an error and the context does not time out
func RetryWithContext ¶
RetryWithContext retries f every interval until the specified context times out.
func StringSliceContains ¶
func StringSliceEndsWith ¶
func StringSlicesEqual ¶
func StringifySelector ¶
func TcpPortInUse ¶
func TcpPortNextFree ¶
Types ¶
type CheckedFunc ¶
type CheckedFunc func() error
type ConditionFunc ¶
type ResultFunc ¶
type ResultFunc func() Result