MCPcopy Create free account
hub / github.com/diillson/chatcli / applyListOp

Method applyListOp

cli/workspace/memory/profile.go:270–289  ·  view source on GitHub ↗

applyListOp executes one list operation; callers must hold the write lock.

(field string, op listOp, value string)

Source from the content-addressed store, hash-verified

268
269// applyListOp executes one list operation; callers must hold the write lock.
270func (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

Callers 1

applyUpdateMethod · 0.95

Calls 5

listRefMethod · 0.95
replaceItemsFunction · 0.85
splitListItemsFunction · 0.85
removeItemsFunction · 0.85
upsertItemsFunction · 0.85

Tested by

no test coverage detected