Versions in this module Expand all Collapse all v0 v0.1.1 Aug 23, 2026 v0.1.0 Aug 17, 2026 Changes in this version + var ErrMaxAttemptsExceeded = errors.New("retry: max attempts exceeded") + var ErrNoOperation = errors.New("retry: operation must not be nil") + func Decorate0(fn func(ctx context.Context) error, opts ...Option) func(ctx context.Context) error + func Decorate[T any, R any](fn func(ctx context.Context, args T) (R, error), opts ...Option) func(ctx context.Context, args T) (R, error) + func Do(ctx context.Context, op Operation, opts ...Option) error + func IsMaxAttempts(err error) bool + type Backoff interface + NextDelay func(attempt int) time.Duration + type CircuitBreaker interface + Execute func(ctx context.Context, op func(context.Context) error) error + type ExponentialBackoff struct + Base time.Duration + Factor float64 + Jitter bool + MaxDelay time.Duration + func NewExponentialBackoff(base, maxDelay time.Duration, factor float64, jitter bool) *ExponentialBackoff + func (e *ExponentialBackoff) NextDelay(attempt int) time.Duration + type FixedInterval struct + Interval time.Duration + func NewFixedInterval(interval time.Duration) *FixedInterval + func (f *FixedInterval) NextDelay(_ int) time.Duration + type NoBackoff struct + func (NoBackoff) NextDelay(_ int) time.Duration + type Operation func(ctx context.Context) error + type Option func(*Options) + func WithBackoff(b Backoff) Option + func WithCircuitBreaker(cb CircuitBreaker) Option + func WithExponentialBackoff(base, maxDelay time.Duration, factor float64, jitter bool) Option + func WithFixedInterval(interval time.Duration) Option + func WithMaxAttempts(n int) Option + func WithNoBackoff() Option + func WithOnError(fn func(attempts int, err error)) Option + func WithOnRetry(fn func(attempt int, err error)) Option + func WithOnSuccess(fn func(attempts int)) Option + func WithRetryIf(fn func(error) bool) Option + func WithTimeout(d time.Duration) Option + type Options struct + Backoff Backoff + CircuitBreaker CircuitBreaker + MaxAttempts int + OnError func(attempts int, err error) + OnRetry func(attempt int, err error) + OnSuccess func(attempts int) + RetryIf func(error) bool + Timeout time.Duration