66//
77// As a simple example:
88//
9- // type Options struct {
10- // Query string `url:"q"`
11- // ShowAll bool `url:"all"`
12- // Page int `url:"page"`
13- // }
9+ // type Options struct {
10+ // Query string `url:"q"`
11+ // ShowAll bool `url:"all"`
12+ // Page int `url:"page"`
13+ // }
1414//
15- // opt := Options{ "foo", true, 2 }
16- // v, _ := query.Values(opt)
17- // fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
15+ // opt := Options{ "foo", true, 2 }
16+ // v, _ := query.Values(opt)
17+ // fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
1818//
1919// The exact mapping between Go values and url.Values is described in the
2020// documentation for the Values() function.
@@ -47,8 +47,8 @@ type Encoder interface {
4747//
4848// Each exported struct field is encoded as a URL parameter unless
4949//
50- // - the field's tag is "-", or
51- // - the field is empty and its tag specifies the "omitempty" option
50+ // - the field's tag is "-", or
51+ // - the field is empty and its tag specifies the "omitempty" option
5252//
5353// The empty values are false, 0, any nil pointer or interface value, any array
5454// slice, map, or string of length zero, and any type (such as time.Time) that
@@ -59,19 +59,19 @@ type Encoder interface {
5959// field's tag value is the key name, followed by an optional comma and
6060// options. For example:
6161//
62- // // Field is ignored by this package.
63- // Field int `url:"-"`
62+ // // Field is ignored by this package.
63+ // Field int `url:"-"`
6464//
65- // // Field appears as URL parameter "myName".
66- // Field int `url:"myName"`
65+ // // Field appears as URL parameter "myName".
66+ // Field int `url:"myName"`
6767//
68- // // Field appears as URL parameter "myName" and the field is omitted if
69- // // its value is empty
70- // Field int `url:"myName,omitempty"`
68+ // // Field appears as URL parameter "myName" and the field is omitted if
69+ // // its value is empty
70+ // Field int `url:"myName,omitempty"`
7171//
72- // // Field appears as URL parameter "Field" (the default), but the field
73- // // is skipped if empty. Note the leading comma.
74- // Field int `url:",omitempty"`
72+ // // Field appears as URL parameter "Field" (the default), but the field
73+ // // is skipped if empty. Note the leading comma.
74+ // Field int `url:",omitempty"`
7575//
7676// For encoding individual field values, the following type-dependent rules
7777// apply:
@@ -88,8 +88,8 @@ type Encoder interface {
8888// "url" tag) will use the value of the "layout" tag as a layout passed to
8989// time.Format. For example:
9090//
91- // // Encode a time.Time as YYYY-MM-DD
92- // Field time.Time `layout:"2006-01-02"`
91+ // // Encode a time.Time as YYYY-MM-DD
92+ // Field time.Time `layout:"2006-01-02"`
9393//
9494// Slice and Array values default to encoding as multiple URL values of the
9595// same name. Including the "comma" option signals that the field should be
@@ -103,9 +103,9 @@ type Encoder interface {
103103// from the "url" tag) will use the value of the "del" tag as the delimiter.
104104// For example:
105105//
106- // // Encode a slice of bools as ints ("1" for true, "0" for false),
107- // // separated by exclamation points "!".
108- // Field []bool `url:",int" del:"!"`
106+ // // Encode a slice of bools as ints ("1" for true, "0" for false),
107+ // // separated by exclamation points "!".
108+ // Field []bool `url:",int" del:"!"`
109109//
110110// Anonymous struct fields are usually encoded as if their inner exported
111111// fields were fields in the outer struct, subject to the standard Go
@@ -117,7 +117,7 @@ type Encoder interface {
117117// Nested structs have their fields processed recursively and are encoded
118118// including parent fields in value names for scoping. For example,
119119//
120- // "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
120+ // "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
121121//
122122// All other values are encoded using their default string representation.
123123//
0 commit comments