Documentation
¶
Index ¶
- func Do(ctx context.Context, do func() error, deferFunc func()) (err error)
- func DoWithRetry(fn func() error, opts ...RetryOption) error
- func DoWithTimeout(timeout time.Duration, do func() error, deferFunc func()) error
- func DoWithoutDefer(ctx context.Context, do func() error) error
- type RetryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoWithRetry ¶ added in v0.1.9
func DoWithRetry(fn func() error, opts ...RetryOption) error
DoWithRetry runs fn, and retries if failed. Default to retry 3 times.
func DoWithTimeout ¶
DoWithTimeout fn with timeout control.
Types ¶
type RetryOption ¶ added in v0.1.9
type RetryOption func(*retryOptions)
RetryOption defines the method to customize DoWithRetry.
func WithRetry ¶ added in v0.1.9
func WithRetry(times int) RetryOption
WithRetry customize a DoWithRetry call with given retry times.
Click to show internal directories.
Click to hide internal directories.