Documentation ¶
Overview ¶
Package binding is used to bind request data into go objects.
Index ¶
Constants ¶
View Source
const ( MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack" MIMEYAML = "application/x-yaml" )
Content-Type MIME of the most common data formats.
Variables ¶
View Source
var ( JSON = jsonBinding{} XML = xmlBinding{} Form = formBinding{} Query = queryBinding{} // FormPost = formPostBinding{} // FormMultipart = formMultipartBinding{} ProtoBuf = protobufBinding{} MsgPack = msgpackBinding{} YAML = yamlBinding{} // URI = uriBinding{} Header = headerBinding{} )
View Source
var ( JSONMimeApplication = "application/json" JSONMimeText = "text/json" JSONMimeJS = "text/javascript" MsgPackMime = "application/msgpack" MsgPackMimeX = "application/x-msgpack" ProtoBufMime = "application/x-protobuf" XMLMimeApplication = "application/xml" XMLMimeText = "text/xml" YAMLMime = "application/x-yaml" MultipartPostFormMime = "multipart/form-data" PostFormMime = "application/x-www-form-urlencoded" )
View Source
var ALL = []Binding{JSON, MsgPack, Form}
View Source
var EnableDecoderDisallowUnknownFields = false
EnableDecoderDisallowUnknownFields is used to call the DisallowUnknownFields method on the JSON Decoder used to decode the reader into the interface. Enabling this makes it so the Decoder will return an error when the input contains keys which do not match exported fields in the destination.
View Source
var EnableDecoderUseNumber = false
EnableDecoderUseNumber is used to call the UseNumber method on the JSON Decoder used to decode the reader into the interface.
Functions ¶
Types ¶
type Validator ¶
type Validator interface { // ValidateStruct is the method that is called to validate a struct. ValidateStruct(interface{}) error // Validator is the method that is called to return the validator that is used to validate the struct. // For example the default validator will return an instance of github.com/go-playground/validator/v10's Validate struct. Validator() interface{} }
Validator represents an interface that has to be implemented in order for it to be used as a validator.
Click to show internal directories.
Click to hide internal directories.