Package query implements encoding of structs into URL query parameters.

As a simple example:

type Options struct {
	Query   string `url:"q"`
	ShowAll bool   `url:"all"`
	Page    int    `url:"page"`

opt := Options{ "foo", true, 2 }
v, _ := query.Values(opt)
fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"

The exact mapping between Go values and url.Values is described in the documentation for the Values() function.

query is referenced in 0 repositories