MCPcopy
hub / github.com/mathaou/termdbms / InsertItem

Method InsertItem

list/list.go:328–338  ·  view source on GitHub ↗

Insert an item at the given index. This returns a command.

(index int, item Item)

Source from the content-addressed store, hash-verified

326
327// Insert an item at the given index. This returns a command.
328func (m *Model) InsertItem(index int, item Item) tea.Cmd {
329 var cmd tea.Cmd
330 m.items = insertItemIntoSlice(m.items, item, index)
331
332 if m.filterState != Unfiltered {
333 cmd = filterItems(*m)
334 }
335
336 m.updatePagination()
337 return cmd
338}
339
340// RemoveItem removes an item at the given index. If the index is out of bounds
341// this will be a no-op. O(n) complexity, which probably won't matter in the

Callers

nothing calls this directly

Calls 3

updatePaginationMethod · 0.95
insertItemIntoSliceFunction · 0.85
filterItemsFunction · 0.85

Tested by

no test coverage detected