applyListOp executes one list operation; callers must hold the write lock.
(field string, op listOp, value string)
| 268 | |
| 269 | // applyListOp executes one list operation; callers must hold the write lock. |
| 270 | func (ps *UserProfileStore) applyListOp(field string, op listOp, value string) bool { |
| 271 | list := ps.listRef(field) |
| 272 | if list == nil { |
| 273 | return false |
| 274 | } |
| 275 | switch op { |
| 276 | case opReplace: |
| 277 | return replaceItems(list, splitListItems(value)) |
| 278 | case opRemove: |
| 279 | if value == "" { |
| 280 | return false |
| 281 | } |
| 282 | return removeItems(list, splitListItems(value)) |
| 283 | default: |
| 284 | if value == "" { |
| 285 | return false |
| 286 | } |
| 287 | return upsertItems(list, splitListItems(value)) |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | // addMilestones appends dated timeline events, skipping restatements of an |
| 292 | // already-recorded milestone (same stem). Milestones split only on ';' and |
no test coverage detected