Documentation ¶
Index ¶
Constants ¶
View Source
const ( ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeMultipart = "multipart/form-data" ContentTypeJson = "application/json" )
Content Type
View Source
const ( // Parse data error ERR_EMPTY_CONTENT_TYPE = "empty Content-Type" ERR_UNSUPPORTED_CONTENT_TYPE = "unsupported Content-Type" ERR_PARSE_FORM = "parse form failed" ERR_PARSE_MULTIPART_FORM = "parse multipart form failed" ERR_DECODE_JSON = "decode json failed" // Coerce error ERR_OPTIONAL_PARAM_NOT_FOUND = "optional param not found" ERR_PARAM_NOT_FOUND = "not found" ERR_PARAM_INVALID = "%s expected" ERR_CORRUPTED_FILE = "corrupted file" ERR_PARAM_FILE_NOT_FOUND = "file not found" ERR_FILE_TYPE_INVALID = "file expected" // Validate error ERR_PARAM_FILE_TOO_LARGE = "file larger than %d bytes" ERR_INVALID_MAX_SIZE_TAG = "invalid `max_size` tag, must be int" ERR_INVALID_VALID_TAG = "invalid `valid` tag, must be `required` or `optional`" ERR_INVALID_MAX_TAG = "invalid `max` tag, must be int or float" ERR_INVALID_MIN_TAG = "invalid `min` tag, must be int or float" ERR_INVALID_RANGE_TAG = "invalid `range` tag, must be (int|int) or (float|float)" ERR_INVALID_BASE64 = "invalid base64 string" ERR_INVALID_UTF8_STRING = "invalid utf8 string" ERR_GREATER_THAN_MAX = "greater than %s" ERR_SMALLER_THAN_MIN = "smaller than %s" ERR_BLANK_STRING = "blank string" ERR_INVALID_ENUMERATION = "%s is not in %s" ERR_WRONG_FORMAT = "wrong format, shold match regexp `%s`" ERR_NOT_IN_RANGE = "not in range (%s, %s)" )
Error Message
View Source
const Version = "v0.2.0"
Version is the current validator's version.
Variables ¶
View Source
var MultipartMemory int64 = 64 * 1024 * 1024
MultipartMemory is the maximum permitted size of the request body in an HTTP request. The whole request body is parsed and up to a total of MultipartMemory bytes of its file parts are stored in memory, with the remainder stored on disk in temporary files.
Functions ¶
func Bind ¶
Bind takes data out of the request and deserializes into a interface obj according to the Content-Type of the request. If no Content-Type is specified, there better be data in the query string, otherwise an error will be produced. A non-nil return value may be an Errors value.
func BindMultipart ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.