package form
import "github.com/ajg/form"
Package form implements encoding and decoding of application/x-www-form-urlencoded data.
Index ¶
- func DecodeString(dst interface{}, src string) error
- func DecodeValues(dst interface{}, vs url.Values) error
- func EncodeToString(dst interface{}) (string, error)
- func EncodeToValues(dst interface{}) (url.Values, error)
- type Decoder
- func NewDecoder(r io.Reader) *Decoder
- func (d Decoder) Decode(dst interface{}) error
- func (d Decoder) DecodeString(dst interface{}, src string) error
- func (d Decoder) DecodeValues(dst interface{}, vs url.Values) error
- func (d *Decoder) DelimitWith(r rune) *Decoder
- func (d *Decoder) EscapeWith(r rune) *Decoder
- func (d *Decoder) IgnoreCase(ignoreCase bool)
- func (d *Decoder) IgnoreUnknownKeys(ignoreUnknown bool)
- type Encoder
Functions ¶
func DecodeString ¶
DecodeString decodes src into dst.
func DecodeValues ¶
DecodeValues decodes vs into dst.
func EncodeToString ¶
EncodeToString encodes dst as a form and returns it as a string.
func EncodeToValues ¶
EncodeToValues encodes dst as a form and returns it as Values.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes data from a form (application/x-www-form-urlencoded).
func NewDecoder ¶
NewDecoder returns a new form Decoder.
func (Decoder) Decode ¶
Decode reads in and decodes form-encoded data into dst.
func (Decoder) DecodeString ¶
DecodeString decodes src into dst.
func (Decoder) DecodeValues ¶
DecodeValues decodes vs into dst.
func (*Decoder) DelimitWith ¶
DelimitWith sets r as the delimiter used for composite keys by Decoder d and returns the latter; it is '.' by default.
func (*Decoder) EscapeWith ¶
EscapeWith sets r as the escape used for delimiters (and to escape itself) by Decoder d and returns the latter; it is '\\' by default.
func (*Decoder) IgnoreCase ¶
IgnoreCase if set to true it will make the Decoder try to set values in the destination object even if the case does not match.
func (*Decoder) IgnoreUnknownKeys ¶
IgnoreUnknownKeys if set to true it will make the Decoder ignore values that are not found in the destination object instead of returning an error.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder provides a way to encode to a Writer.
func NewEncoder ¶
NewEncoder returns a new form Encoder.
func (*Encoder) DelimitWith ¶
DelimitWith sets r as the delimiter used for composite keys by Encoder e and returns the latter; it is '.' by default.
func (Encoder) Encode ¶
Encode encodes dst as form and writes it out using the Encoder's Writer.
func (*Encoder) EscapeWith ¶
EscapeWith sets r as the escape used for delimiters (and to escape itself) by Encoder e and returns the latter; it is '\\' by default.
func (*Encoder) KeepZeros ¶
KeepZeros sets whether Encoder e should keep zero (default) values in their literal form when encoding, and returns the former; by default zero values are not kept, but are rather encoded as the empty string.
Source Files ¶
decode.go encode.go form.go node.go
- Version
- v1.5.1 (latest)
- Published
- Mar 18, 2019
- Platform
- windows/amd64
- Imports
- 10 packages
- Last checked
- now –
Tools for package owners.