Documentation
¶
Index ¶
- Constants
- func CodeIntError(resp *req.Resp, err error) bool
- func CodeStrError(resp *req.Resp, err error) bool
- func Delete(url string, v ...interface{}) (*req.Resp, error)
- func Get(url string, v ...interface{}) (*req.Resp, error)
- func Head(url string, v ...interface{}) (*req.Resp, error)
- func HttpStatusError(resp *req.Resp, err error) bool
- func NetworkError(resp *req.Resp, err error) bool
- func Options(url string, v ...interface{}) (*req.Resp, error)
- func Patch(url string, v ...interface{}) (*req.Resp, error)
- func Post(url string, v ...interface{}) (*req.Resp, error)
- func Put(url string, v ...interface{}) (*req.Resp, error)
- type RetryClient
- func (r *RetryClient) Delete(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Do(method, url string, v ...interface{}) (out *req.Resp, err error)
- func (r *RetryClient) Get(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Head(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Options(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Patch(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Post(url string, v ...interface{}) (*req.Resp, error)
- func (r *RetryClient) Put(url string, v ...interface{}) (*req.Resp, error)
- type RetryCondFunc
- type RetryIntervalFunc
- type StdIntResp
- type StdStrResp
Constants ¶
View Source
const (
SuccessInt = 0
)
View Source
const (
SuccessStr = "E000"
)
Variables ¶
This section is empty.
Functions ¶
func NetworkError ¶
RetryCondFunc 1. network error
Types ¶
type RetryClient ¶
type RetryClient struct {
// contains filtered or unexported fields
}
func NewRetryClient ¶
func NewRetryClient(maxRetry int, retryIntervalFunc RetryIntervalFunc, retryCondFunc RetryCondFunc) *RetryClient
func (*RetryClient) Delete ¶
func (r *RetryClient) Delete(url string, v ...interface{}) (*req.Resp, error)
Delete execute a http DELETE request
func (*RetryClient) Do ¶
func (r *RetryClient) Do(method, url string, v ...interface{}) (out *req.Resp, err error)
Do execute request.
func (*RetryClient) Get ¶
func (r *RetryClient) Get(url string, v ...interface{}) (*req.Resp, error)
Get execute a http GET request
func (*RetryClient) Head ¶
func (r *RetryClient) Head(url string, v ...interface{}) (*req.Resp, error)
Head execute a http HEAD request
func (*RetryClient) Options ¶
func (r *RetryClient) Options(url string, v ...interface{}) (*req.Resp, error)
Options execute a http OPTIONS request
func (*RetryClient) Patch ¶
func (r *RetryClient) Patch(url string, v ...interface{}) (*req.Resp, error)
Patch execute a http PATCH request
type RetryIntervalFunc ¶
RetryIntervalFunc : The value of counter starts from 1
func ConstantInterval ¶
func ConstantInterval(interval time.Duration) RetryIntervalFunc
RetryIntervalFunc : The value of counter starts from 1
func ExponentInterval ¶
func ExponentInterval(interval time.Duration) RetryIntervalFunc
type StdIntResp ¶
type StdIntResp struct {
Code int `json:"code"`
}
type StdStrResp ¶
type StdStrResp struct {
Code string `json:"code"`
}
Click to show internal directories.
Click to hide internal directories.