Repository navigation
Releases: stretchr/objx
Release list
v0.8.0
New features
-
Map.Deleteremoves values by selector. It takes one or more selectors in the same dot and bracket notation asGetandSet, removes the map keys or slice elements they point to, and returns the map so calls can be chained:m.Delete("books[1].chapters[2].title", "draft")
Selectors run in order, so after a slice element is removed, later selectors see the shifted indexes. Missing paths and out-of-range indexes are ignored. Removing a slice element builds a new slice of the same type (
[]stringstays[]string) and leaves the original backing array untouched. Maps along the path are modified in place. (#174)
What's Changed
New Contributors
Full Changelog: v0.7.0...v0.8.0
v0.7.0
Upgrade notes
Behavior changes
Hasnow reports keys whose value isnil.Map.Hasused to returnfalseboth for missing keys and for keys set tonil, so the two couldn't be told apart. It now returnstruewhenever the selector exists, including nested keys, bracket keys and slice indexes that holdnil. If you relied onHasto mean "set and not nil", use!m.Get(selector).IsNil()instead. (#172)
Other
- Added a contributing guide (#183), a security policy (#182) and issue templates (#184).
- The Go workflow token is now restricted to read-only contents (#181).
What's Changed
- Restrict the Go workflow token to read-only contents by @hanzei in #181
- Add a security policy by @hanzei in #182
- Add a contributing guide by @hanzei in #183
- Add bug report and feature request issue templates by @hanzei in #184
- Differentiate nil values from missing keys in Map.Has by @AdamMagued in #172
New Contributors
- @AdamMagued made their first contribution in #172
Full Changelog: v0.6.0...v0.7.0
v0.6.0
Upgrade notes
Go 1.25 or later is now required (previously Go 1.20). (#175)
Behavior changes
Where*now returns the items the decider selects. Previously everyWhere*method (WhereInt,WhereStr,WhereMSI,WhereObjxMap, …) returned the items for which the decider returnedfalse, the opposite of what its documentation says. If you negated your decider to work around this, remove the negation. (#180)- Indexed
Setupdates the element instead of replacing the slice.Set("names[0]", "Mat")used to replace the wholenamesslice with"Mat"; it now sets only the first element. Indexing into a value that isn't a slice (e.g.Get("name[0]")on a string) now returns a missing value instead of the value itself. (#170) - Nil slices and maps stay
nullin JSON.objx.Map{"items": []any(nil)}now encodes as{"items":null}instead of{"items":[]}. Empty, non-nil containers still encode as[]/{}. (#171) URLValueskeeps every element of a slice of maps. With the[]and""key suffixes, only the last element's values used to be kept.[]anyvalues (e.g. arrays decoded from JSON) are now encoded element by element instead of as a Go-syntax string. (#177)- The error returned by
SetURLValuesSliceKeySuffixfor an invalid suffix now readsobjx: invalid URLValuesSliceKeySuffix provided. (#176)
Other
- The API now uses
anyinstead ofinterface{}. They are the same type, so this doesn't affect callers. (#175) - The type-specific accessors are now generated with
go generate(#179), and CI runs golangci-lint (#176, #178).
What's Changed
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #163
- Fix flaky TestConversionURLValues when run with -shuffle by @hanzei in #165
- Bump go-task/setup-task from 1 to 2 by @dependabot[bot] in #166
- Bump actions/checkout from 6 to 7 by @dependabot[bot] in #167
- Bump actions/setup-go from 6 to 7 by @dependabot[bot] in #168
- Preserve slices when setting an indexed value by @vitalivo in #170
- Preserve null values when converting nil containers to JSON by @x0Lazarus in #171
- Modernize: use any, require Go 1.25, apply go fix by @hanzei in #175
- Add golangci-lint and run it in CI by @hanzei in #176
- Enable more linters and the gofumpt and goimports formatters by @hanzei in #178
- Cover nested URL values and keep repeated map-slice entries by @hanzei in #177
- Replace the browser-based codegen with go generate by @hanzei in #179
- Fix Where* returning the items the decider rejected by @hanzei in #180
New Contributors
- @vitalivo made their first contribution in #170
- @x0Lazarus made their first contribution in #171
Full Changelog: v0.5.3...v0.6.0
v0.5.3
What's Changed
- Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 by @dependabot[bot] in #150
- Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 by @dependabot[bot] in #152
- Add syntax highlighting in README by @JakeRoggenbuck in #153
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #155
- Bump github.com/stretchr/testify from 1.10.0 to 1.11.0 by @dependabot[bot] in #156
- Bump github.com/stretchr/testify from 1.11.0 to 1.11.1 by @dependabot[bot] in #157
- Remove codeclimate integration by @hanzei in #160
- Bump actions/setup-go from 5 to 6 by @dependabot[bot] in #158
- Extend test coverage to include go 1.25 by @hanzei in #161
- Remove duplicate module cache from CI by @hanzei in #162
- Replace
testifyassertions with custom testing helpers by @emilien-puget in #159
New Contributors
- @JakeRoggenbuck made their first contribution in #153
- @emilien-puget made their first contribution in #159
Full Changelog: v0.5.2...v0.5.3
v0.5.2
What's Changed
- Bump actions/checkout from 3 to 4 by @dependabot in #143
- Bump actions/setup-go from 4 to 5 by @dependabot in #144
- Bump actions/cache from 3 to 4 by @dependabot in #145
- Update taskfile to latest version by @hanzei in #148
- Update supported go versions to latest three by @hanzei in #149
- Update testify by @hanzei in #147
Full Changelog: v0.5.1...v0.5.2
v0.5.1
What's Changed
- Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #126
- Fix a couple typos in the README.md by @autarch in #128
- Fix typos in comments and function names by @alexandear in #129
- Use go1.13; remove vendor folder; update .github action by @alexandear in #130
- Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 by @dependabot in #132
- Bump actions/setup-go from 3 to 4 by @dependabot in #133
- gofmt 1.20 by @dolmen in #139
- deps: fix dependency cycle with testify (#124) by @dolmen in #140
New Contributors
- @autarch made their first contribution in #128. Thank you for your contribution!
- @alexandear made their first contribution in #129. Thank you for your contribution!
- @dolmen made their first contribution in #139. Thank you for your contribution!
Full Changelog: v0.5.0...v0.5.1
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Notes
This release drops the support for go version less then 1.10.
Enhancements
- ea4fe68 Move to go modules (#91)
- d2ce263 Update to go 1.12 (#90)
- ef50b0d Update to go 1.11 (#83)
- d0444fc Update dependencies (#82)
- b8b73a3 URLQuery with index slice keys (#74)
- 9e1dfc1 Update dependencies (#81)
- 0ab728f New tests for type_specific.go and fixed code (#75)
- 652affc Add PULL_REQUEST_TEMPLATE.md (#77)
- c8db58a Move type Map out of type_specific_codegen.go (#73)
- fb88214 URLValues without sprinf, support for maps and slices (#63)
- a5cfa15 Add go 1.10 tests && update dependencies (#67)
- 2b6f327 When calling Set() with key pointing to nonexistent map path, the path will be created. (#66)
- ca93b98 Convert floats to int when parsing JSON (#59)
- 3f41636 Move tests to objx_test (#58)
- fcc2171 Remove constants file (#57)
- cfebd64 Codeclimate (#54)
- 84b0369 Refactor accessors (#53)
Fixes
- c61a9df Fix for map[interface{}]interface{} to JSON conversion (#87)
- d3a9fb1 Fix for #7 (#85)
- 77d0150 Nil value returns empty string. (#76)
- a97c7cc Fixed incorrect result for obj.Value().MSI() getter (#65)
- 2532633 Fix indentation (#69)
- 8a3f715 Fix bug introduced with #17 (#60)
- e89b2c1 Fix ObjxMapSlice (#17)