增加请求的数据结构与响应的数据结构定义
This commit is contained in:
48
request/define.go
Normal file
48
request/define.go
Normal file
@ -0,0 +1,48 @@
|
||||
// Package request...
|
||||
//
|
||||
// Description : 定义请求的数据结构
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-08-01 8:28 下午
|
||||
package request
|
||||
|
||||
// APIMethod 定义API请求的信息
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 8:29 下午 2021/8/1
|
||||
type APIMethod struct {
|
||||
ServiceDomain string `json:"service_domain"` // 调用服务的域名
|
||||
URI string `json:"uri"` // 调用的URI
|
||||
Method string `json:"method"` // 请求方法
|
||||
ISRestfulURI bool `json:"is_restful_uri"` // 是否为restful uri
|
||||
Header map[string]string `json:"header"` // 请求header
|
||||
|
||||
}
|
||||
|
||||
// ResponseConfig ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 8:32 下午 2021/8/1
|
||||
type ResponseConfig struct {
|
||||
ISJson bool `json:"is_json"` // 响应数据是否为json
|
||||
CodeKey string `json:"code_key"` // 代表业务Code的Key
|
||||
MessageKey string `json:"message_key"` // 描述业务code的key
|
||||
DataKey string `json:"data_key"` // 返回数据的key
|
||||
SuccessRule string `json:"success_rule"` // 请求成功的规则, http_code / business_code http状态码或者业务状态码, 如果是通过http code 判断是否为请求成功 code key / message key 配置无效
|
||||
SuccessCode []string `json:"success_code"` // 哪些状态码被认为是请求成功
|
||||
}
|
||||
|
||||
// APIResponse API响应数据
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 8:54 下午 2021/8/1
|
||||
type APIResponse struct {
|
||||
Data string `json:"data"` // 响应数据
|
||||
Cost int64 `json:"cost"` // 接口耗时
|
||||
StartRequestTime int64 `json:"start_request_time"` // 开始请求时间
|
||||
FinishRequestTime int64 `json:"finish_request_time"` // 完成请求时间
|
||||
}
|
Reference in New Issue
Block a user