Documentation ¶
Index ¶
- Constants
- Variables
- func Validate(form Form, data Data) error
- func ValidateForm(form Form, data url.Values) error
- func ValidateJSON(form Form, reader io.Reader) error
- func ValidateMultipartForm(form Form, data *multipart.Form) error
- type BaseForm
- func (form *BaseForm) Clean(_ Data) error
- func (form *BaseForm) FieldError(field string, code uint, parameters ...interface{}) error
- func (form *BaseForm) FormError(code uint, errors ...error) error
- func (form *BaseForm) Messages() map[uint]string
- func (form *BaseForm) OnError(err *FormError) error
- func (form *BaseForm) Schema() Schema
- type Clean
- type Data
- type FieldError
- type Form
- type FormData
- type FormError
- type JSON
- type MultipartFormData
- type Schema
- type Value
Constants ¶
View Source
const ( Unknown uint = iota InvalidJSON Required Invalid )
Variables ¶
View Source
var Messages = map[uint]string{ Unknown: "Unknown error.", Invalid: "Ensure that all values are valid.", InvalidJSON: "Unable to parse JSON.", Required: "Value is required.", }
Functions ¶
Types ¶
type FieldError ¶
type FieldError struct { Code uint `json:"code"` Field string `json:"field"` Message string `json:"message"` Parameters []interface{} `json:"parameters"` }
func NewFieldError ¶
func NewFieldError(code uint, field, message string, parameters []interface{}) *FieldError
func (*FieldError) Error ¶
func (err *FieldError) Error() string
func (*FieldError) Format ¶
func (err *FieldError) Format() string
type FormError ¶
type MultipartFormData ¶
type MultipartFormData struct {
// contains filtered or unexported fields
}
func (MultipartFormData) Get ¶
func (data MultipartFormData) Get(name string) interface{}
func (MultipartFormData) GetAll ¶
func (data MultipartFormData) GetAll(name string) interface{}
Click to show internal directories.
Click to hide internal directories.