Documentation ¶
Index ¶
Constants ¶
View Source
const ( MIMEJSON = "application/json" MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" )
Variables ¶
View Source
var ( Form = formBinding{} FormPost = formPostBinding{} FormMultipart = formMultipartBinding{} Header = headerBinding{} JSON = jsonBinding{} Query = queryBinding{} Uri = uriBinding{} XML = xmlBinding{} )
实现Binding接口,并可用于将请求中的数据绑定到struct实例
View Source
var EnableDecoderDisallowUnknownFields = false
EnableDecoderDisallowUnknownFields 用于调用JSON解码器实例上的DisallowUnknownFields方法. 当目标为结构且输入包含与目标中任何未忽略的导出字段不匹配的对象键时,使解码器返回错误.
View Source
var EnableDecoderUseNumber = false
EnableDecoderUseNumber 用于调用JSON解码器实例上的UseNumber方法. UseNumber 使解码器将一个数字解组到接口中,作为数字而不是float64.
Functions ¶
This section is empty.
Types ¶
type BindingBody ¶
BindingBody 添加BindBody方法到Binding. BindBody与Bind类似,但它从提供的bytes读取,而不是req.Body.
type BindingUri ¶
BindingUri 添加BindUri方法到Binding. BindUri与Bind类似,但它读取Params
type StructValidator ¶
type StructValidator interface { ValidateStruct(interface{}) error // 可接收任何类型,即使配置不正确,也不引发异常. Engine() interface{} // 提供支持的基础验证器 }
StructValidator 是需要实现的最小接口,以便用作验证中枢,以确保请求的正确性.
var Validator StructValidator = &defaultValidator{}
Validator 实现StructValidator接口的默认验证器.
Click to show internal directories.
Click to hide internal directories.