request 数据接口定义

This commit is contained in:
白茶清欢 2024-05-31 12:33:36 +08:00
parent cdc5f556e5
commit 07e2f5532f
3 changed files with 29 additions and 4 deletions

View File

@ -13,8 +13,27 @@ package define
//
// Date : 17:10 2024/5/24
type Request struct {
Body map[string]any `json:"body"` // 请求Body
Header map[string]string `json:"header"` // 请求Header
Cookie map[string]string `json:"cookie"` // 请求Cookie
Query map[string]string `json:"query"` // 请求query
Body map[string]any `json:"body"` // 请求Body
Header map[string]string `json:"header"` // 请求Header
Cookie map[string]string `json:"cookie"` // 请求Cookie
Query map[string]string `json:"query"` // 请求query
FullUrl string `json:"full_url"` // 完整的请求URL
ContentType string `json:"content_type"` // 请求类型
Method string `json:"method"` // 请求方法
DataField string `json:"data_field"` // 数据字段
CodeField string `json:"code_field"` // 业务状态码字段
MessageField string `json:"message_field"` // code描述字段
RetryRule *RequestRetryRule `json:"retry_rule"` // 重试规则
}
// RequestRetryRule 重试规则
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 12:26 2024/5/31
type RequestRetryRule struct {
RetryCount int64 `json:"retry_count"` // 重试次数
RetryTimeInterval int64 `json:"retry_time_interval"` // 重试的时间间隔 1 - 10 之间, 单位毫秒
RetryHttpCodeList []int64 `json:"retry_http_code_list"` // 哪些http状态码需要重试
RetryBusinessCodeList []string `json:"retry_business_code_list"` // 哪些业务状态码需要重试
}

2
go.mod
View File

@ -4,5 +4,7 @@ go 1.22.3
require (
github.com/go-resty/resty/v2 v2.13.1 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.25.0 // indirect
)

4
go.sum
View File

@ -1,6 +1,10 @@
github.com/go-resty/resty/v2 v2.13.1 h1:x+LHXBI2nMB1vqndymf26quycC4aggYJ7DECYbiz03g=
github.com/go-resty/resty/v2 v2.13.1/go.mod h1:GznXlLxkq6Nh4sU59rPmUw3VtgpO3aS96ORAI6Q7d+0=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=