Versions in this module Expand all Collapse all v0 v0.1.0 Aug 16, 2026 Changes in this version + var ErrBodyNotReplayable = errors.New("request body cannot be replayed") + var ErrExhausted = errors.New("retry attempts exhausted") + var ErrInvalidConfiguration = errors.New("invalid retry configuration") + func Do[T any](ctx context.Context, fn func(context.Context) (T, error), opts ...Option) (T, error) + type AttemptEvent struct + Attempt int + type Backoff func(retryNumber int) time.Duration + func Constant(delay time.Duration) Backoff + func Exponential(initial time.Duration) Backoff + func ExponentialJitter(initial time.Duration) Backoff + type ExhaustedError struct + Attempts int + Err error + func (e *ExhaustedError) Error() string + func (e *ExhaustedError) Is(target error) bool + func (e *ExhaustedError) Unwrap() error + type ExhaustedEvent struct + Attempts int + Err error + HTTPStatus int + type HTTPPolicy func(req *http.Request, resp *http.Response, err error) bool + type Hooks struct + OnAttempt func(AttemptEvent) + OnExhausted func(ExhaustedEvent) + OnRetry func(RetryEvent) + type Option interface + func WithBackoff(backoff Backoff) Option + func WithHTTPPolicy(policy HTTPPolicy) Option + func WithHooks(hooks Hooks) Option + func WithIdempotencyKeyHeader(header string) Option + func WithMaxAttempts(attempts int) Option + func WithMaxDelay(delay time.Duration) Option + func WithRetryPolicy(policy Policy) Option + func WithRetryableMethods(methods ...string) Option + type Policy func(error) bool + type RetryEvent struct + Attempt int + Delay time.Duration + Err error + HTTPStatus int + NextAttempt int + type Transport struct + func NewTransport(base http.RoundTripper, opts ...Option) *Transport + func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)