()
| 69 | } |
| 70 | |
| 71 | func ExamplePointer_Get() { |
| 72 | var doc exampleDocument |
| 73 | |
| 74 | if err := json.Unmarshal(testDocumentJSONBytes, &doc); err != nil { // populates doc |
| 75 | fmt.Println(err) |
| 76 | |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | pointer, err := New("/foo/1") |
| 81 | if err != nil { |
| 82 | fmt.Println(err) |
| 83 | |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | value, kind, err := pointer.Get(doc) |
| 88 | if err != nil { |
| 89 | fmt.Println(err) |
| 90 | |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | fmt.Printf( |
| 95 | "value: %q\nkind: %v\n", |
| 96 | value, kind, |
| 97 | ) |
| 98 | |
| 99 | // Output: |
| 100 | // value: "baz" |
| 101 | // kind: string |
| 102 | } |
| 103 | |
| 104 | func ExamplePointer_Set() { |
| 105 | var doc exampleDocument |