Introduce bounds-based ranges, directional iterators, and Entry API updates; add docs/tests#1
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Asc/Desc).EntryAPIs across map-like types to a consistent upsert/delete contract that returns the previous value and existence flag, and addDeletehelpers.READMEexamples to reflect the new APIs.Description
boundpackage implementingBound,RangeBoundsand helpers (NewIncluded,NewExcluded,NewUnbounded) andContains/IsValidsemantics for comparator-based ranges, and addboundunit tests (bound/bound_test.go).Iter()->IterAsc()/IterDesc(),Range(lower, upper)->RangeAsc(bounds)/RangeDesc(bounds), and matching mutable variants likeIterMutAsc/IterMutDescandRangeMutAsc/RangeMutDesc(changes applied tobtree,btreemap,btreeset,skipmap,skipset, etc.).Entry.Insertto return(old V, existed bool)and addEntry.Delete()forhashmap,btreemap,skipmap,trieand related entry implementations, and update underlyingInsert/inserthelpers to route through theEntrylogic where applicable.ds.go(Bound,RangeBounds,NewRangeBounds), addGetComparatoronBTreeMap, addEqualhelpers on sets, update many iterators/Range callers in tests and code to use the newboundAPI, and refreshREADME.md,CONTRIBUTING.md, andAGENTS.mdto document conventions.Testing
gofmt -was part of changes and updated examples and tests to the new APIs.go test ./..., and all automated tests succeeded.Codex Task