Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRetriable ¶
IsRetriable determines if an error is retriable. Returns true for transient errors that may succeed on retry.
Types ¶
type Config ¶
type Config struct {
// MaxAttempts is the maximum number of attempts before giving up.
MaxAttempts int
// InitialBackoff is the initial backoff duration before the first retry.
InitialBackoff time.Duration
// MaxBackoff is the maximum backoff duration between retries.
MaxBackoff time.Duration
// BackoffMultiplier is the factor by which backoff increases each attempt.
BackoffMultiplier float64
}
Config holds the configuration for retry behavior.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default retry configuration.
type Option ¶
type Option func(*Config)
Option is a functional option for configuring retry behavior.
func WithBackoffMultiplier ¶
WithBackoffMultiplier sets the backoff multiplier.
func WithInitialBackoff ¶
WithInitialBackoff sets the initial backoff duration.
func WithMaxAttempts ¶
WithMaxAttempts sets the maximum number of retry attempts.
func WithMaxBackoff ¶
WithMaxBackoff sets the maximum backoff duration.
type RetryableDBTX ¶
type RetryableDBTX struct {
// contains filtered or unexported fields
}
RetryableDBTX wraps a DBTX with retry logic.
func (*RetryableDBTX) Exec ¶
func (r *RetryableDBTX) Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
Exec executes a query with retry logic.
Click to show internal directories.
Click to hide internal directories.