Documentation ¶
Index ¶
- Constants
- func DecorateConsumer[T any](retry Retry, fn func(T) error) func(T) error
- func DecorateFunction[T any, R any](retry Retry, fn func(T) (R, error)) func(T) (R, error)
- func DecorateRunnable(retry Retry, fn func() error) func() error
- func DecorateSupplier[T any](retry Retry, fn func() (T, error)) func() (T, error)
- func DefaultFailureResultPredicate(_ any, err error) bool
- func DefaultWaitIntervalFunction(_ int) time.Duration
- type Config
- type ConfigBuilder
- type ErrorEvent
- type Event
- type EventListener
- type EventType
- type MaxRetriesExceeded
- type Metrics
- type Retry
- type RetryEvent
- type SuccessEvent
Constants ¶
View Source
const DefaultFailAfterMaxAttempts bool = false
View Source
const DefaultMaxAttempts int = 3
View Source
const DefaultWaitDuration = time.Millisecond * 500
Variables ¶
This section is empty.
Functions ¶
func DecorateFunction ¶
func DecorateRunnable ¶
func DecorateSupplier ¶
func DefaultFailureResultPredicate ¶ added in v0.3.0
Types ¶
type ConfigBuilder ¶
type ConfigBuilder func(*Config)
func WithFailAfterMaxAttempts ¶
func WithFailAfterMaxAttempts(failAfterMaxAttempts bool) ConfigBuilder
func WithFailureResultPredicate ¶ added in v0.3.0
func WithFailureResultPredicate(predicate func(any, error) bool) ConfigBuilder
func WithMaxAttempts ¶
func WithMaxAttempts(maxAttempts int) ConfigBuilder
func WithWaitIntervalFunction ¶
func WithWaitIntervalFunction(function func(int) time.Duration) ConfigBuilder
type ErrorEvent ¶ added in v0.4.1
type ErrorEvent interface { Event }
type EventListener ¶
type EventListener interface { OnSuccessFunc(func(SuccessEvent)) EventListener OnRetryFunc(func(RetryEvent)) EventListener OnErrorFunc(func(ErrorEvent)) EventListener DismissSuccessFunc(func(SuccessEvent)) EventListener DismissRetryFunc(func(RetryEvent)) EventListener DismissErrorFunc(func(ErrorEvent)) EventListener OnSuccess(fn.Consumer[SuccessEvent]) EventListener OnRetry(fn.Consumer[RetryEvent]) EventListener OnError(fn.Consumer[ErrorEvent]) EventListener DismissSuccess(fn.Consumer[SuccessEvent]) EventListener DismissRetry(fn.Consumer[RetryEvent]) EventListener DismissError(fn.Consumer[ErrorEvent]) EventListener }
type MaxRetriesExceeded ¶
type MaxRetriesExceeded struct {
// contains filtered or unexported fields
}
func (*MaxRetriesExceeded) Error ¶
func (e *MaxRetriesExceeded) Error() string
type Retry ¶
type Retry interface { Name() string Metrics() Metrics EventListener() EventListener Execute(func() (any, error)) (any, error) }
func NewRetry ¶
func NewRetry(name string, configs ...ConfigBuilder) Retry
type RetryEvent ¶ added in v0.4.1
type SuccessEvent ¶ added in v0.4.1
type SuccessEvent interface { Event }
Click to show internal directories.
Click to hide internal directories.