Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse will parse the http.Request form and look for v's fields. It uses http.FormValue internally. It will return an error if an invalid v is passed and an *ErrValidate if a validation error occurs. Use ErrValidate.String() when returning a validation error to the client.
func RegisterHandler ¶
func RegisterHandler(name string, handler FormatHandler)
RegisterHandler can be used to register custom field validation. The name of the handler will be used in the struct tag for the validate key. For example, if you registered a "phone" validate handler, your struct tag would be `pint:"phone,validate:phone"`.
Types ¶
type ErrValidate ¶
type ErrValidate struct {
Description string
}
ErrValidate is a custom error type returned by validation functions, the Error() format should only be used internally. Use ErrValidate.String() for an error that can be returned to the client.
func (*ErrValidate) Error ¶
func (e *ErrValidate) Error() string
func (*ErrValidate) String ¶
func (e *ErrValidate) String() string