Skip to content

Releases: go-playground/form

Release 2.2.0

23 Aug 21:23

Choose a tag to compare

What was added?

Added Mode to both the Encoder and Decoder and can be set with the SetMode(mode) function on either.

currently there are 2 modes:

  • ModeImplicit - the default mode, looks through all fields to encode or decode values
  • ModeExplicit - looks through only field marked explicitly with the form tag name

this is for #10 thanks @annismckenzie for the idea

no breaking changes, just update and enjoy.

Release 2.1.0

02 Aug 01:28

Choose a tag to compare

What was added?

  • Just some more minor backend performance updates, no changes.

benchmark                                                       old ns/op     new ns/op     delta
BenchmarkSimpleUserDecodeStruct-8                               318           336           +5.66%
BenchmarkSimpleUserDecodeStructParallel-8                       95.2          99.5          +4.52%
BenchmarkSimpleUserEncodeStruct-8                               1000          972           -2.80%
BenchmarkSimpleUserEncodeStructParallel-8                       325           329           +1.23%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1058          1014          -4.16%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     324           294           -9.26%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             4823          4799          -0.50%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     1732          1581          -8.72%
BenchmarkComplexArrayDecodeStructAllTypes-8                     16340         16326         -0.09%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             5105          4710          -7.74%
BenchmarkComplexArrayEncodeStructAllTypes-8                     16343         16303         -0.24%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             5969          4979          -16.59%
BenchmarkComplexMapDecodeStructAllTypes-8                       21259         21998         +3.48%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               7493          6542          -12.69%
BenchmarkComplexMapEncodeStructAllTypes-8                       17060         17069         +0.05%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               6421          5609          -12.65%
BenchmarkDecodeNestedStruct-8                                   3488          3366          -3.50%
BenchmarkDecodeNestedStructParallel-8                           1203          1096          -8.89%
BenchmarkEncodeNestedStruct-8                                   2286          2230          -2.45%
BenchmarkEncodeNestedStructParallel-8                           939           780           -16.93%

benchmark                                                       old allocs     new allocs     delta
BenchmarkSimpleUserDecodeStruct-8                               1              1              +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       1              1              +0.00%
BenchmarkSimpleUserEncodeStruct-8                               12             11             -8.33%
BenchmarkSimpleUserEncodeStructParallel-8                       12             11             -8.33%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1              1              +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     1              1              +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             47             46             -2.13%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     47             46             -2.13%
BenchmarkComplexArrayDecodeStructAllTypes-8                     122            121            -0.82%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             122            121            -0.82%
BenchmarkComplexArrayEncodeStructAllTypes-8                     147            146            -0.68%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             147            146            -0.68%
BenchmarkComplexMapDecodeStructAllTypes-8                       131            130            -0.76%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               131            130            -0.76%
BenchmarkComplexMapEncodeStructAllTypes-8                       176            175            -0.57%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               176            175            -0.57%
BenchmarkDecodeNestedStruct-8                                   15             14             -6.67%
BenchmarkDecodeNestedStructParallel-8                           15             14             -6.67%
BenchmarkEncodeNestedStruct-8                                   17             16             -5.88%
BenchmarkEncodeNestedStructParallel-8                           17             16             -5.88%

benchmark                                                       old bytes     new bytes     delta
BenchmarkSimpleUserDecodeStruct-8                               64            64            +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       64            64            +0.00%
BenchmarkSimpleUserEncodeStruct-8                               549           485           -11.66%
BenchmarkSimpleUserEncodeStructParallel-8                       549           485           -11.66%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             96            96            +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     96            96            +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             3073          3009          -2.08%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     3072          3010          -2.02%
BenchmarkComplexArrayDecodeStructAllTypes-8                     2289          2257          -1.40%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             2291          2257          -1.48%
BenchmarkComplexArrayEncodeStructAllTypes-8                     7351          7288          -0.86%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             7351          7290          -0.83%
BenchmarkComplexMapDecodeStructAllTypes-8                       5338          5306          -0.60%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               5342          5308          -0.64%
BenchmarkComplexMapEncodeStructAllTypes-8                       7161          7100          -0.85%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               7161          7099          -0.87%
BenchmarkDecodeNestedStruct-8                                   416           384           -7.69%
BenchmarkDecodeNestedStructParallel-8                           416           384           -7.69%
BenchmarkEncodeNestedStruct-8                                   768           704           -8.33%
BenchmarkEncodeNestedStructParallel-8                           768           704           -8.33%

Release 2.0.0

26 Jul 14:27

Choose a tag to compare

What's New in 2.0.0?

  • form now supports Decoding and Encoding of almost any type, not just structs. for #6
    eg.
// example url.Values
values := map[string][]string{ "val1", "val2" }

var arr []string

d.Decode(&arr, values)

Thanks @themihai for suggesting #6 and questioning #7

Any Fixes?

  • Corrected a bug where when decoding non indexed array values into an array with existing values was overwriting the current values instead of appending to the array, this has been corrected. ( Don't worry too much, most people won't have been using a pre-filled array )

Release 1.10.0

17 Jul 16:43

Choose a tag to compare

What's New?

  • Nothing just some more backend only performance updates.
benchmark                                                       old ns/op     new ns/op     delta
BenchmarkSimpleUserDecodeStruct-8                               308           298           -3.25%
BenchmarkSimpleUserDecodeStructParallel-8                       94.8          91.4          -3.59%
BenchmarkSimpleUserEncodeStruct-8                               989           966           -2.33%
BenchmarkSimpleUserEncodeStructParallel-8                       332           313           -5.72%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1004          1010          +0.60%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     291           285           -2.06%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             4771          4718          -1.11%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     1575          1673          +6.22%
BenchmarkComplexArrayDecodeStructAllTypes-8                     17087         16145         -5.51%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             5020          4943          -1.53%
BenchmarkComplexArrayEncodeStructAllTypes-8                     16219         16020         -1.23%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             4961          5129          +3.39%
BenchmarkComplexMapDecodeStructAllTypes-8                       24898         22933         -7.89%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               7771          6366          -18.08%
BenchmarkComplexMapEncodeStructAllTypes-8                       16885         16861         -0.14%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               5851          5159          -11.83%
BenchmarkDecodeNestedStruct-8                                   3848          3482          -9.51%
BenchmarkDecodeNestedStructParallel-8                           1325          1011          -23.70%
BenchmarkEncodeNestedStruct-8                                   2319          2255          -2.76%
BenchmarkEncodeNestedStructParallel-8                           874           738           -15.56%

benchmark                                                       old allocs     new allocs     delta
BenchmarkSimpleUserDecodeStruct-8                               1              1              +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       1              1              +0.00%
BenchmarkSimpleUserEncodeStruct-8                               12             12             +0.00%
BenchmarkSimpleUserEncodeStructParallel-8                       12             12             +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1              1              +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     1              1              +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             47             47             +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     47             47             +0.00%
BenchmarkComplexArrayDecodeStructAllTypes-8                     123            122            -0.81%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             123            122            -0.81%
BenchmarkComplexArrayEncodeStructAllTypes-8                     147            147            +0.00%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             147            147            +0.00%
BenchmarkComplexMapDecodeStructAllTypes-8                       135            131            -2.96%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               135            131            -2.96%
BenchmarkComplexMapEncodeStructAllTypes-8                       176            176            +0.00%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               176            176            +0.00%
BenchmarkDecodeNestedStruct-8                                   16             15             -6.25%
BenchmarkDecodeNestedStructParallel-8                           16             15             -6.25%
BenchmarkEncodeNestedStruct-8                                   17             17             +0.00%
BenchmarkEncodeNestedStructParallel-8                           17             17             +0.00%

benchmark                                                       old bytes     new bytes     delta
BenchmarkSimpleUserDecodeStruct-8                               64            64            +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       64            64            +0.00%
BenchmarkSimpleUserEncodeStruct-8                               549           549           +0.00%
BenchmarkSimpleUserEncodeStructParallel-8                       549           549           +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             96            96            +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     96            96            +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             3073          3073          +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     3073          3072          -0.03%
BenchmarkComplexArrayDecodeStructAllTypes-8                     2513          2289          -8.91%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             2518          2291          -9.02%
BenchmarkComplexArrayEncodeStructAllTypes-8                     7350          7351          +0.01%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             7351          7351          +0.00%
BenchmarkComplexMapDecodeStructAllTypes-8                       7088          5338          -24.69%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               7121          5341          -25.00%
BenchmarkComplexMapEncodeStructAllTypes-8                       7159          7161          +0.03%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               7161          7160          -0.01%
BenchmarkDecodeNestedStruct-8                                   640           416           -35.00%
BenchmarkDecodeNestedStructParallel-8                           640           416           -35.00%
BenchmarkEncodeNestedStruct-8                                   768           768           +0.00%
BenchmarkEncodeNestedStructParallel-8                           768           768           +0.00%

Release 1.9.0

09 Jul 15:22

Choose a tag to compare

Whats New?

  • Just some more minor backend performance updates inspired by Go 1.7 RC1 changes to the JSON package, parallel performance updated by 10-20% with latest changes.

benchmark                                                       old ns/op     new ns/op     delta
BenchmarkSimpleUserDecodeStruct-8                               319           308           -3.45%
BenchmarkSimpleUserDecodeStructParallel-8                       116           94.8          -18.28%
BenchmarkSimpleUserEncodeStruct-8                               1015          989           -2.56%
BenchmarkSimpleUserEncodeStructParallel-8                       411           332           -19.22%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1038          1004          -3.28%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     368           291           -20.92%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             5014          4771          -4.85%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     1973          1575          -20.17%
BenchmarkComplexArrayDecodeStructAllTypes-8                     17656         17087         -3.22%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             5801          5020          -13.46%
BenchmarkComplexArrayEncodeStructAllTypes-8                     16318         16219         -0.61%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             5955          4961          -16.69%
BenchmarkComplexMapDecodeStructAllTypes-8                       25196         24898         -1.18%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               9443          7771          -17.71%
BenchmarkComplexMapEncodeStructAllTypes-8                       17061         16885         -1.03%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               6375          5851          -8.22%
BenchmarkDecodeNestedStruct-8                                   4102          3848          -6.19%
BenchmarkDecodeNestedStructParallel-8                           1399          1325          -5.29%
BenchmarkEncodeNestedStruct-8                                   2440          2319          -4.96%
BenchmarkEncodeNestedStructParallel-8                           1045          874           -16.36%

benchmark                                                       old allocs     new allocs     delta
BenchmarkSimpleUserDecodeStruct-8                               1              1              +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       1              1              +0.00%
BenchmarkSimpleUserEncodeStruct-8                               12             12             +0.00%
BenchmarkSimpleUserEncodeStructParallel-8                       12             12             +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             1              1              +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     1              1              +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             47             47             +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     47             47             +0.00%
BenchmarkComplexArrayDecodeStructAllTypes-8                     123            123            +0.00%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             123            123            +0.00%
BenchmarkComplexArrayEncodeStructAllTypes-8                     147            147            +0.00%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             147            147            +0.00%
BenchmarkComplexMapDecodeStructAllTypes-8                       135            135            +0.00%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               135            135            +0.00%
BenchmarkComplexMapEncodeStructAllTypes-8                       176            176            +0.00%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               176            176            +0.00%
BenchmarkDecodeNestedStruct-8                                   16             16             +0.00%
BenchmarkDecodeNestedStructParallel-8                           16             16             +0.00%
BenchmarkEncodeNestedStruct-8                                   17             17             +0.00%
BenchmarkEncodeNestedStructParallel-8                           17             17             +0.00%

benchmark                                                       old bytes     new bytes     delta
BenchmarkSimpleUserDecodeStruct-8                               64            64            +0.00%
BenchmarkSimpleUserDecodeStructParallel-8                       64            64            +0.00%
BenchmarkSimpleUserEncodeStruct-8                               549           549           +0.00%
BenchmarkSimpleUserEncodeStructParallel-8                       549           549           +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypes-8             96            96            +0.00%
BenchmarkPrimitivesDecodeStructAllPrimitivesTypesParallel-8     96            96            +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypes-8             3073          3073          +0.00%
BenchmarkPrimitivesEncodeStructAllPrimitivesTypesParallel-8     3072          3073          +0.03%
BenchmarkComplexArrayDecodeStructAllTypes-8                     2515          2513          -0.08%
BenchmarkComplexArrayDecodeStructAllTypesParallel-8             2518          2518          +0.00%
BenchmarkComplexArrayEncodeStructAllTypes-8                     7351          7350          -0.01%
BenchmarkComplexArrayEncodeStructAllTypesParallel-8             7351          7351          +0.00%
BenchmarkComplexMapDecodeStructAllTypes-8                       7089          7088          -0.01%
BenchmarkComplexMapDecodeStructAllTypesParallel-8               7123          7121          -0.03%
BenchmarkComplexMapEncodeStructAllTypes-8                       7162          7159          -0.04%
BenchmarkComplexMapEncodeStructAllTypesParallel-8               7160          7161          +0.01%
BenchmarkDecodeNestedStruct-8                                   640           640           +0.00%
BenchmarkDecodeNestedStructParallel-8                           640           640           +0.00%
BenchmarkEncodeNestedStruct-8                                   768           768           +0.00%
BenchmarkEncodeNestedStructParallel-8                           768           768           +0.00%

Release 1.8.0

03 Jul 19:52

Choose a tag to compare

What Changed?

  • backend only changes, no breaking changes.
  • fine tuned a few more internals for max performance and decreasing allocations, library is now balanced between primitive and complex struct decoding and encoding with least allocations for both.
  • squashed a potential bug with calculated slice length, upgrading to latest version is recommended

Release 1.7.1

29 Jun 14:08

Choose a tag to compare

What Changed?

  • Corrected issue where time pointer, *time.Time, was not getting set on the struct field when using built in time parsing. corrected in commit 762ce96, adding this line was the fix.

Thanks @bikbah for reporting!

Release 1.7.0

29 Jun 03:22

Choose a tag to compare

What's New

Nothing anyone needs to worry about, all backend changes.

  • Minor performance updates, reduced allocations for maps and arrays.
  • Updated Benchmarks

Release 1.6.0

23 Jun 01:14

Choose a tag to compare

What Changed?

  • Nothing just added ajg/form benchmarks as a comparison was requested.

Release 1.5.0

21 Jun 14:13

Choose a tag to compare

What's New?

  • Added Array/Slice global limit size, please refer to #2, reported by @justinas

by default limit is 10,000 which should suit most peoples needs however if a higher or lower limit is desired/required it can be adjusted with the function SetMaxArraySize(size uint)