Documentation ¶
Overview ¶
Package form provides decoding functions for an http request forms (query, url-encoded, multipart). The decoding consists of both unmarshalling of the query and validation. Validation consist of builtin tag options like required but also by self validation of your destination interface. Customs types can be used for unmarshalling if they implements encoding.TextUnmarshaller, encoding.BinaryUnmarshaler, StringSetter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TextUnmarshalerType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem() BinaryUnmarshalerType = reflect.TypeOf(new(encoding.BinaryUnmarshaler)).Elem() StringSetterType = reflect.TypeOf(new(StringSetter)).Elem() )
Types implementing TexTUnmarshaler and StringSetter used on unmarshalling
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { BoolStrictMode bool Input *problem.Input // contains filtered or unexported fields }
Decoder handles unmarshalling and validation of its request's query
func NewDecoder ¶
NewDecoder return a pointer to a new decoder
type IntList ¶
type IntList []int
IntList implements encoding.TextUnmarshaler in order to extract query of form ?key=1,2,3,4 onto an int slice
func (*IntList) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type StringList ¶
type StringList []string
StringList implements encoding.TextUnmarshaler in order to extract query of form ?key=foo,bar onto a string slice
func (*StringList) UnmarshalText ¶
func (l *StringList) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler