package
0.3.1
Repository: https://github.com/u2takey/go-utils.git
Documentation: pkg.go.dev

# Functions

Attempts set count of retry default is 10.
BackOffDelay is a DelayType which increases delay between consecutive retries.
CombineDelay is a DelayType the combines all of the specified delays into a new DelayTypeFunc.
Context allow to set context of retry default are Background context example of immediately cancellation (maybe it isn't the best example, but it describes behavior enough; I hope) ctx, cancel := context.WithCancel(context.Background()) cancel() retry.Do( func() error { ..
Delay set delay between retry default is 100ms.
DelayType set type of the delay between retries default is BackOff.
No description provided by the author
FixedDelay is a DelayType which keeps delay the same through all iterations.
IsRecoverable checks if error is an instance of `unrecoverableError`.
return the direct last error that came from the retried function default is false (return wrapped errors with everything).
MaxDelay set maximum delay between retry does not apply by default.
MaxJitter sets the maximum random Jitter between retries for RandomDelay.
OnError allows the caller to retry fn in case the error returned by fn is retriable according to the provided function.
OnRetry function callback are called each retry log each retry example: retry.Do( func() error { return errors.New("some error") }, retry.OnRetry(func(n uint, err error) { log.Printf("#%d: %s\n", n, err) }), ).
RandomDelay is a DelayType which picks a random delay up to config.maxJitter.
RetryIf controls whether a retry should be attempted after an error (assuming there are any retry attempts remaining) skip retry if special error example: retry.Do( func() error { return errors.New("special error") }, retry.RetryIf(func(err error) bool { if err.Error() == "special error" { return false } return true }) ) By default RetryIf stops execution if the error is wrapped using `retry.Unrecoverable`, so above example may also be shortened to: retry.Do( func() error { return retry.Unrecoverable(errors.New("special error")) } ).
RetryOnConflict is used to make an update to a resource when you have to worry about conflicts caused by other code making unrelated updates to the resource at the same time.
Unrecoverable wraps an error in `unrecoverableError` struct.

# Variables

No description provided by the author
No description provided by the author
DefaultBackoff is the recommended backoff for a conflict where a client may be attempting to make an unrelated modification to a resource under active management by one or more controllers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.
No description provided by the author

# Structs

No description provided by the author

# Type aliases

DelayTypeFunc is called to return the next delay to wait after the retriable function fails on `err` after `n` attempts.
Error type represents list of errors in retry.
Function signature of OnRetry function n = count of attempts.
Option represents an option for retry.
Function signature of retryable function.
Function signature of retry if function.