-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add `LocatedNodeList` as the return value of `SelectLocated`. It aliases `[]*spec.LocatedNode` and offers a number of methods for working with located nodes, including sorting, deduplication, and iterators over its nodes and paths. To complement `SelectLocated`'s new return value, change `Select` to return `NodeList` instead of `[]any`. It simply aliases `[]any`, but can offer additional methods. For now, there is just `All`, which returns an iterator over all its nodes. These new collection objects reflect how RFC 9535 talks about "node lists", and `SelectLocated`, in particular, demonstrates how to use located nodes for deduplication, as described by the spec. Sorting of located nodes requires comparison of `NormalizedPath`s, so add the `Compare` method for that purpose. It sorts indexes before names, and otherwise compares indexes and names as one might expect. The use of iterator return values from the nod lists depends on Go 1.23, so require that version. Add more examples for these new collections, and tweak the existing examples to use their `All` iterators.
- Loading branch information
Showing
8 changed files
with
688 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/theory/jsonpath | ||
|
||
go 1.22 | ||
go 1.23 | ||
|
||
require github.com/stretchr/testify v1.10.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.