The following example shows how to replace all values of one or more specific attributes.
()
| 7 | |
| 8 | // The following example shows how to replace all values of one or more specific attributes. |
| 9 | func Example_replaceAnyAttribute() { |
| 10 | operation := `{ |
| 11 | "op": "replace", |
| 12 | "value": { |
| 13 | "emails": [ |
| 14 | { |
| 15 | "value": "quint", |
| 16 | "type": "work", |
| 17 | "primary": true |
| 18 | }, |
| 19 | { |
| 20 | "value": "me@di-wu.be", |
| 21 | "type": "home" |
| 22 | } |
| 23 | ], |
| 24 | "nickname": "di-wu" |
| 25 | } |
| 26 | }` |
| 27 | validator, _ := NewValidator(operation, schema.CoreUserSchema()) |
| 28 | fmt.Println(validator.Validate()) |
| 29 | // Output: |
| 30 | // map[emails:[map[primary:true type:work value:quint] map[type:home value:me@di-wu.be]] nickname:di-wu] <nil> |
| 31 | } |
| 32 | |
| 33 | // The following example shows how to replace all of the members of a group with a different members list in a single |
| 34 | // replace operation. |
nothing calls this directly
no test coverage detected
searching dependent graphs…