Skip to content

Commit 319a1cc

Browse files
committed
updates README to reflect rename of JSONPointer to Pointer
1 parent 2f921a2 commit 319a1cc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Package jsonpointer provides the ability to resolve, assign, and delete values
66
of any type, including raw JSON, by [JSON
77
Pointers](https://datatracker.ietf.org/doc/html/rfc6901).
88

9-
109
## Install
1110

1211
```bash
@@ -38,9 +37,9 @@ func main() {
3837

3938
r := Root{ Nested: Nested{ Str: "nested str" }}
4039

41-
// jsonpointer.JSONPointer is a string type so if you have a properly
40+
// jsonpointer.Pointer is a string type so if you have a properly
4241
// formatted json pointer then you can simply convert it:
43-
// ptr := jsonpointer.JSONPointer(myPointer)
42+
// ptr := jsonpointer.Pointer(myPointer)
4443
// err := ptr.Validate()
4544

4645
// Note: jsonpointer.New encodes each token's value.
@@ -96,24 +95,24 @@ func main() {
9695
### Interfaces
9796

9897
Package jsonpointer provides 3 interfaces: `Assigner`, `Resolver`, and
99-
`Deleter`. Regardless of the operation, if `Resolver` is implemented, `ResolveJSONPointer` will be
100-
called. `ResolveJSONPointer` should not have side effects. If resolving for an assignment, utilize the
98+
`Deleter`. Regardless of the operation, if `Resolver` is implemented, `ResolvePointer` will be
99+
called. `ResolvePointer` should not have side effects. If resolving for an assignment, utilize the
101100
pointer to infer which type should be assigned.
102101

103-
`AssignByJSONPointer` is invoked on the way back from the leaf. `DeleteByJSONPointer` is invoked after resolving the current token.
102+
`AssignByPointer` is invoked on the way back from the leaf. `DeleteByPointer` is invoked after resolving the current token.
104103

105-
All three methods are passed a pointer to the `jsonpointer.JSONPointer` so that
104+
All three methods are passed a pointer to the `jsonpointer.Pointer` so that
106105
it can be modified. If you do not modify it, jsonpointer will assume the current
107106
token was addressed and continue on.
108107

109108
If you wish to only handle some cases with the interfaces, return `jsonpointer.YieldOperation` to have the jsonpointer package resolve, assign, or delete as if the type did not implement the interface. Note that doing so results in changes to `ptr` being dismissed.
110109

111-
### JSONPointer methods
110+
### Pointer methods
112111

113112
All methods return new values rather than modifying the pointer itself. If you wish to modify the pointer in one of the interface methods, you will need to reassign it: `*ptr = newPtrVal`
114113

115114
```go
116-
func (mt MyType) ResolveJSONPointer(ptr *jsonpointer.JSONPointer, op Operation) (interface{}, error) {
115+
func (mt MyType) ResolvePointer(ptr *jsonpointer.Pointer, op Operation) (interface{}, error) {
117116
next, t, ok := ptr.Next()
118117
if !ok {
119118
// this will only occur if the ptr is a root token in this circumstance

0 commit comments

Comments
 (0)