MCPcopy Index your code
hub / github.com/TanStack/db / set

Method set

packages/db/src/utils/btree.ts:173–180  ·  view source on GitHub ↗

* Adds or overwrites a key-value pair in the B+ tree. * @param key the key is used to determine the sort order of * data in the tree. * @param value data to associate with the key (optional) * @param overwrite Whether to overwrite an existing key-value pair * (default: t

(key: K, value: V, overwrite?: boolean)

Source from the content-addressed store, hash-verified

171 * has data that does not affect its sort order.
172 */
173 set(key: K, value: V, overwrite?: boolean): boolean {
174 if (this._root.isShared) this._root = this._root.clone()
175 const result = this._root.set(key, value, overwrite, this)
176 if (result === true || result === false) return result
177 // Root node has split, so create a new root node.
178 this._root = new BNodeInternal<K, V>([this._root, result])
179 return true
180 }
181
182 /**
183 * Returns true if the key exists in the B+ tree, false if not.

Callers 15

setPairsMethod · 0.95
useLiveQueryFunction · 0.45
generateIdFunction · 0.45
getAdapterForCollectionFunction · 0.45
ensureCollectionStateMethod · 0.45
sendRPCOnceMethod · 0.45
getOrderByObjectIdFunction · 0.45
loadSubsetMethod · 0.45
ensureCollectionReadyMethod · 0.45

Calls 1

cloneMethod · 0.80

Tested by 9

createRecordingAdapterFunction · 0.36
constructorMethod · 0.36
tryGrantNextLockFunction · 0.36
createMockCollectionFunction · 0.36
createIndexUsageTrackerFunction · 0.36
createPersistedAdapterFunction · 0.36
verifyOrderFunction · 0.36
groupResultsByKeyFunction · 0.36