util

package
v0.0.0-...-4d57693 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToListIfValid

func AddToListIfValid(given []string, add string, more ...string) []string

AddToListIfValid adds the provided entries if they are not nil This logic results in removal of duplicates & empty entries if any

func RemoveFromListIfValid

func RemoveFromListIfValid(given []string, remove string, more ...string) []string

RemoveFromListIfValid removes the provided entries if they are not nil. This logic results in removal of duplicates & empty entries if any

func Retry

func Retry(opts RetryOptions, cond func() (bool, error)) error

Retry will execute the condition & repeatedly in intervals till this condition returns true or times out

Note: It is valid for a condition to return true with error Note: Original error throws by the condition is preserved

Types

type RetryOptions

type RetryOptions struct {
	// Immediate when true runs the condition first & then waits
	// if required
	Immediate bool
	Interval  time.Duration
	Timeout   time.Duration
}

Jump to

Keyboard shortcuts

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