The following example shows how to change a User's entire "work" address, using a "valuePath" filter.
()
| 74 | |
| 75 | // The following example shows how to change a User's entire "work" address, using a "valuePath" filter. |
| 76 | func Example_replaceWorkAddress() { |
| 77 | operation := `{ |
| 78 | "op": "replace", |
| 79 | "path": "addresses[type eq \"work\"]", |
| 80 | "value": { |
| 81 | "type": "work", |
| 82 | "streetAddress": "ExampleStreet 1", |
| 83 | "locality": "ExampleCity", |
| 84 | "postalCode": "0001", |
| 85 | "country": "BE", |
| 86 | "primary": true |
| 87 | } |
| 88 | }` |
| 89 | validator, _ := NewValidator(operation, schema.CoreUserSchema()) |
| 90 | fmt.Println(validator.Validate()) |
| 91 | // Output: |
| 92 | // [map[country:BE locality:ExampleCity postalCode:0001 primary:true streetAddress:ExampleStreet 1 type:work]] <nil> |
| 93 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…