Documentation ¶
Index ¶
- func DeepCopy[T any](src T) (T, error)
- func If[T any](con bool, one, another T) T
- func IfDelay[T any](con bool, one, another func() T) T
- func SimpleRetry[T any](do func() (data T, err error), maxTimes int) (result T, err error)
- func SimpleRetryWithDelay[T any](do func() (data T, err error), maxTimes int, delay time.Duration) (result T, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SimpleRetry ¶
func SimpleRetryWithDelay ¶ added in v0.1.13
func SimpleRetryWithDelay[T any](do func() (data T, err error), maxTimes int, delay time.Duration) (result T, err error)
SimpleRetry 一个简单的重试工具
参数:
do:处理函数, 返回 data是函数返回数据,也是SimpleRetry最终返回的数据;ok 表示是否处理成功,成功则结束重试 maxTimes: 最大重试次数
返回值:
result: 对应do函数的返回值 err: 代表最终结果是否成功
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.