Documentation ¶
Overview ¶
Package urlvalues fills form values with the contents of a struct.
This package is meant to be used in conjunction with the gorilla toolkit's schema (https://github.com/gorilla/schema) library, which decodes values into structs.
Example
type Person struct { Name string `url:"name"` Phone string `url:"phone"` } func main() { jane := &Person{"Jane Doe", "(111) 555-5555"} vals := url.Values{} // Encode Person into url.Values encoder := urlvalues.NewEncoder() encoder.Encode(jane, vals) // Use url.Values.Encode() to output a query string // name=Jane+Doe&phone=%28111%29+555-5555 fmt.Println(vals.Encode()) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
TagID string
}
Encoder encodes values from a struct into url.Values.
func (*Encoder) Encode ¶
Encode encodes a struct into map[string][]string.
Intended for use with url.Values.
func (*Encoder) SetAliasTag ¶
SetAliasTag changes the tag used to locate urlvalues annotations. The default value is "url"
Click to show internal directories.
Click to hide internal directories.