json:struct tags instead of
binding.Bindis a convenient wrapper over the other handlers in this package. It does the following boilerplate for you:
Content-Typewill be used to know how to deserialize the requests.
binding.Formdeserializes form data from the request, whether in the query string or as a
form-urlencodedpayload. It only does these things:
binding.Errorsinto your own handler if you want to handle errors.
binding.MultipartFormdeserializes form data from a request into the struct you pass in. Additionally, this will deserialize a POST request that has a form of
enctype="multipart/form-data". If the bound struct contains a field of type
*multipart.FileHeader), you also can read any uploaded files that were part of the form.
binding.Form, no error handling is performed, but you can get the errors and handle them yourself.
binding.Validatorinterface like so:
binding.ErrorHandlerinterface like so: