The following example shows how to change a specific sub-attribute "streetAddress" of complex attribute "emails" selected by a "valuePath" filter.
()
| 61 | // The following example shows how to change a specific sub-attribute "streetAddress" of complex attribute "emails" |
| 62 | // selected by a "valuePath" filter. |
| 63 | func Example_replaceSpecificSubAttribute() { |
| 64 | operation := `{ |
| 65 | "op": "replace", |
| 66 | "path": "addresses[type eq \"work\"].streetAddress", |
| 67 | "value": "ExampleStreet 100" |
| 68 | }` |
| 69 | validator, _ := NewValidator(operation, schema.CoreUserSchema()) |
| 70 | fmt.Println(validator.Validate()) |
| 71 | // Output: |
| 72 | // ExampleStreet 100 <nil> |
| 73 | } |
| 74 | |
| 75 | // The following example shows how to change a User's entire "work" address, using a "valuePath" filter. |
| 76 | func Example_replaceWorkAddress() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…