Documentation ¶
Overview ¶
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-01 22:07:18 * @FilePath: \go-toolbox\pkg\retry\retry.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrCallbackFunc ¶
ErrCallbackFunc 是重试时的错误回调函数类型 nowAttemptCount 表示当前尝试次数 remainCount 表示剩余尝试次数 err 是当前执行时的错误信息
type Retry ¶
type Retry struct {
// contains filtered or unexported fields
}
Retry 结构体用于实现重试机制
func (*Retry) SetAttemptCount ¶
SetAttemptCount 设置最大尝试次数,返回 Retry 实例以支持链式调用
func (*Retry) SetErrCallback ¶
func (r *Retry) SetErrCallback(errCallbackFunc ErrCallbackFunc) *Retry
SetErrCallback 设置错误回调函数,返回 Retry 实例以支持链式调用
Click to show internal directories.
Click to hide internal directories.