Documentation ¶
Index ¶
- Constants
- func CalcRequestSize(r *http.Request) int64
- func CanRecordContextBody(h http.Header) bool
- func ExtContextTypeToUTF8(s string) string
- func HttpHandlerFuncToGinHandlerFunc(handler http.HandlerFunc) gin.HandlerFunc
- func HttpHandlerToGinHandlerFunc(handler http.Handler) gin.HandlerFunc
- func StringFilterFlags(content string) string
- type BaseHttpResponse
- type HttpQueryPaginated
- type HttpResponseItemsID
- type HttpResponseItemsTotal
- type HttpResponsePaginated
Constants ¶
View Source
const ( HttpRequestOkCode int64 = 0 HttpRequestErrorCode int64 = iota + 10 )
View Source
const ( ConstHttpHeaderContentType = "Content-Type" ConstHttpHeaderJsonContentTypeValue = binding.MIMEJSON ConstHttpHeaderXmlContentTypeValue = binding.MIMEXML ConstHttpHeaderXml2ContentTypeValue = binding.MIMEXML2 ConstHttpHeaderYamlContentTypeValue = binding.MIMEYAML ConstHttpHeaderTomlContentTypeValue = binding.MIMETOML ConstHttpHeaderTextContentTypeValue = binding.MIMEPlain ConstHttpHeaderJavascriptContentTypeValue = "application/javascript" )
View Source
const (
HttpRequestOk = "success"
)
Variables ¶
This section is empty.
Functions ¶
func CalcRequestSize ¶
CalcRequestSize返回请求(request)对象的大小
func CanRecordContextBody ¶
CanRecordContextBody 检查HTTP请求头中是否存在特定内容类型的值。
func ExtContextTypeToUTF8 ¶
func HttpHandlerFuncToGinHandlerFunc ¶
func HttpHandlerFuncToGinHandlerFunc(handler http.HandlerFunc) gin.HandlerFunc
HttpHandlerFuncToGinHandlerFunc 将标准的 http.HandlerFunc 包装为 gin.HandlerFunc
func HttpHandlerToGinHandlerFunc ¶
func HttpHandlerToGinHandlerFunc(handler http.Handler) gin.HandlerFunc
HttpHandlerToGinHandlerFunc 将标准的 http.Handler 包装为 gin.HandlerFunc
func StringFilterFlags ¶
StringFilterFlags 返回给定字符串中第一个标记。
Types ¶
type BaseHttpResponse ¶
type BaseHttpResponse struct { Code int64 `json:"errorCode" yaml:"errorCode"` // 响应代码 ErrorMessage string `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty"` // 错误信息 ErrorDetail interface{} `json:"errorDetail,omitempty" yaml:"errorDetail,omitempty"` // 错误详细信息 Data interface{} `json:"data,omitempty" yaml:"data,omitempty"` // 响应数据 }
type HttpQueryPaginated ¶
type HttpResponseItemsID ¶
type HttpResponseItemsID struct {
ID int64 `json:"id" yaml:"id"` // 响应对象 Id
}
type HttpResponseItemsTotal ¶
type HttpResponseItemsTotal struct {
TotalCount int64 `json:"totalCount" yaml:"totalCount"` // 响应对象总数
}
type HttpResponsePaginated ¶
type HttpResponsePaginated struct { HttpResponseItemsTotal HttpQueryPaginated BaseHttpResponse }
HttpResponsePaginated 匿名对象后面不需要 json 相关的描述,就回平铺结构
Click to show internal directories.
Click to hide internal directories.