go-playground/form
:steam_locomotive: Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support.
30 Releases
Latest: 8mo ago
Release 4.3.0v4.3.0Latest
📋 What's Changed
- Improve issue #71: Optimize nested structure decoding performance by @Jecoms in https://github.com/go-playground/form/pull/73
- updates by @deankarn in https://github.com/go-playground/form/pull/74
- Update logo image source in README.md by @deankarn in https://github.com/go-playground/form/pull/75
- Introduced official MSGV(Minimum Supported Go Version) of latest two versions.
✨ New Contributors
- @Jecoms made their first contribution in https://github.com/go-playground/form/pull/73
- Full Changelog: https://github.com/go-playground/form/compare/v4.2.3...v4.3.0
Release 4.2.3v4.2.3
📋 What's Changed
- Revert "Fix panic when the decoding pointer type with custom decoding function" by @deankarn in https://github.com/go-playground/form/pull/69
- retract breaking change by @deankarn in https://github.com/go-playground/form/pull/70
- Full Changelog: https://github.com/go-playground/form/compare/v4.2.2...v4.2.3
Release 4.2.2v4.2.2
📋 What's Changed
- Fix panic when the decoding pointer type with custom decoding function by @adityarsuryavamshi in https://github.com/go-playground/form/pull/68
✨ New Contributors
- @adityarsuryavamshi made their first contribution in https://github.com/go-playground/form/pull/68
- Full Changelog: https://github.com/go-playground/form/compare/v4.2.1...v4.2.2
Release 4.2.1v4.2.1
🐛 What was fixed?
- This updates the library to better handle and bubble up Slice/Array invalid index definition to avoid future confusion. See #60 as an example.
Release 4.2.0v4.2.0
✨ What's new?
- Add setting use brackets as a namespace separator, thanks @alxfv for the [PR](https://github.com/go-playground/form/pull/56)
- Fix panic when we encode uncomparable fields with omitempty tag, thanks @alxfv for the [PR](https://github.com/go-playground/form/pull/57)
Release 4.1.3v4.1.3
🐛 What was fixed?
- corrected error message for floats always being the first element.
Release 4.1.2v4.1.2
What was fixed? Fix panic on map[string]interface{} encode, thanks @Exitialis for the PR
Release 4.1.1v4.1.1
🐛 What was fixed?
- Fixed an `out-of-bounds` exception when a value exists but no parsable values.
Release 4.1.0v4.1.0
✨ What's new?
- Updated deps that now use Go Modules.
Release 4.0.0v4.0.0
✨ What's new?
- Updated to use Go Modules.
Release 3.1.4v3.1.4
🐛 What was fixed?
- Fixed an array/slice index issue for the custom decode function, thanks @vearutop for reporting the [issue](https://github.com/go-playground/form/issues/39)
Release 3.1.3v3.1.3
🐛 What was fixed?
- Fixed encoder issue when `omitempty` used in combination with a pointer. see #34 for details, thanks @mifanich for reporting
Release 3.1.2v3.1.2
🐛 What was fixed?
- Fixed bug introduced in v3.1.1 with array indexes
Release 3.1.1v3.1.1
🐛 What was fixed?
- in PR #32:
- Corrected handling of array, not slice, values that can lead to
- a panic.
- Rearranged logic to handle multiple values if index and non-index are
- mixed eg. `Value=[]string{"1","2"} Value[2]=[]string{"3"}`
- this resolves #29 and #30
Release 3.1.0v3.1.0
✨ What was added
- Added setting for string form value into `interface{}` values; previously they were ignored. thanks @Xzya for the issue
- Why only string and not int, float etc...?
- Because theres no way to tell what type the value should be; just because it *CAN* be parsed into an int, doesn't mean it should be for your application and so I have left it at setting strings.
Release 3.0.1v3.0.1
🐛 What was fixed?
- empty boolean values are now set to false see [here](https://github.com/go-playground/form/issues/21) for details thanks @vearutop
Release 3.0.0v3.0.0
✨ What's new?
- Added Embedded struct support
- Added `omitempty` just like std lib JSON
- Made a version bump to v3.0.0 because the new Embedded struct logic has the potential to affect existing clients.
- please see [examples](https://github.com/go-playground/form/tree/master/_examples) detailing new functionality.
- Thanks to @danielchatfield and @michael2m for creating issues to get these features on the radar :+1:
Release 2.3.0v2.3.0
✨ What was added?
- Added a new function to both the Decoder and Encoder called `RegisterTagNameFunc`.
- Once a custom function has been registered the default, or custom set, tag name is ignored and relies 100% on the function for the field name data.
- The return value WILL BE CACHED and so return value must be CONSISTENT.
Release 2.2.2v2.2.2
🐛 What was fixed?
- Parsing of struct tag, by name, corrected for when multiple tags exists, this was corrected in #15 thanks @htmd
Release 2.2.1v2.2.1
🐛 What was fixed?
- Added additional notes to `RegisterCustomTypeFunc` to indicate that if a struct type is registered a `url.Value` must exist explicitly for the struct and not just the fields.
- eg. `url.Values{"User":"Name%3Djoeybloggs"}` will call the custom type function with `User` as the type, however `url.Values{"User.Name":"joeybloggs"}` will not.
- Fixes #14
Release 2.2.0v2.2.0
✨ 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.0v2.1.0
✨ 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%
- + 58 more
Release 2.0.0v2.0.0
✨ What's New in 2.0.0?
- [form](https://github.com/go-playground/form) now supports Decoding and Encoding of almost any type, not just structs. for #6
- eg.
- ``` go
- // example url.Values
- values := map[string][]string{ "val1", "val2" }
- var arr []string
- d.Decode(&arr, values)
- ```
- + 2 more
🐛 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.0v1.10.0
📋 Changes
- Nothing just some more backend only performance updates.
Release 1.9.0v1.9.0
✨ 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%
- + 58 more
Release 1.8.0v1.8.0
📋 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.1v1.7.1
📋 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 762ce96aa9e35c0f3e10fe0265e6106e59ff9a03, adding [this line](https://github.com/go-playground/form/blob/master/decoder.go#L557) was the fix.
- Thanks @bikbah for reporting!
Release 1.7.0v1.7.0
✨ 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.0v1.6.0
📋 What Changed?
- Nothing just added `ajg/form` benchmarks as a comparison was requested.
Release 1.5.0v1.5.0
✨ 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)`
