You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,13 +12,14 @@ Package form Decodes url.Values into Go value(s) and Encodes Go value(s) into ur
12
12
13
13
It has the following features:
14
14
15
-
- Supports map of almost all types.
16
-
- Supports both Numbered and Normal arrays eg. `"Array[0]"` and just `"Array"` with multiple values passed.
17
-
- Array honours the specified index. eg. if `"Array[2]"` is the only Array value passed down, it will be put at index 2; if array isn't big enough it will be expanded.
18
-
- Only creates objects as necessary eg. if no `array` or `map` values are passed down, the `array` and `map` are left as their default values in the struct.
19
-
- Allows for Custom Type registration.
20
-
- Handles time.Time using RFC3339 time format by default, but can easily be changed by registering a Custom Type, see below.
21
-
- Handles Encoding & Decoding of almost all Go types eg. can Decode into struct, array, map, int... and Encode a struct, array, map, int...
15
+
- Supports map of almost all types.
16
+
- Supports both Numbered and Normal arrays eg. `"Array[0]"` and just `"Array"` with multiple values passed.
17
+
- Slice honours the specified index. eg. if "Slice[2]" is the only Slice value passed down, it will be put at index 2; if slice isn't big enough it will be expanded.
18
+
- Array honours the specified index. eg. if "Array[2]" is the only Array value passed down, it will be put at index 2; if array isn't big enough a warning will be printed and value ignored.
19
+
- Only creates objects as necessary eg. if no `array` or `map` values are passed down, the `array` and `map` are left as their default values in the struct.
20
+
- Allows for Custom Type registration.
21
+
- Handles time.Time using RFC3339 time format by default, but can easily be changed by registering a Custom Type, see below.
22
+
- Handles Encoding & Decoding of almost all Go types eg. can Decode into struct, array, map, int... and Encode a struct, array, map, int...
22
23
23
24
Common Questions
24
25
@@ -48,7 +49,7 @@ Installation
48
49
49
50
Use go get.
50
51
51
-
go get github.com/go-playground/form
52
+
go get -u github.com/go-playground/form
52
53
53
54
Then import the form package into your own code.
54
55
@@ -275,7 +276,7 @@ Field []*string{nil, nil, &i}
275
276
276
277
Benchmarks
277
278
------
278
-
###### Run on MacBook Pro (15-inch, 2017) using go version go1.9 darwin/amd64
279
+
###### Run on MacBook Pro (15-inch, 2017) using go version go1.10.1 darwin/amd64
279
280
280
281
NOTE: the 1 allocation and B/op in the first 4 decodes is actually the struct allocating when passing it in, so primitives are actually zero allocation.
Equal(t, k.Error(), "Array size of '1000' is larger than the maximum currently set on the decoder of '4'. To increase this limit please see, SetMaxArraySize(size uint)")
889
889
890
890
k=err["BadArrayIndex"]
891
-
Equal(t, k.Error(), "Invalid Array index 'bad index'")
891
+
Equal(t, k.Error(), "invalid slice index 'bad index'")
0 commit comments