MCPcopy Create free account
hub / github.com/TanStack/db / writeInsert

Function writeInsert

packages/query-db-collection/src/manual-sync.ts:244–261  ·  view source on GitHub ↗
(data: TInsertInput | Array<TInsertInput>)

Source from the content-addressed store, hash-verified

242
243 return {
244 writeInsert(data: TInsertInput | Array<TInsertInput>) {
245 const operation: SyncOperation<TRow, TKey, TInsertInput> = {
246 type: `insert`,
247 data,
248 }
249
250 const ctx = ensureContext()
251 const batchContext = activeBatchContexts.get(ctx)
252
253 // If we're in a batch, just add to the batch operations
254 if (batchContext?.isActive) {
255 batchContext.operations.push(operation)
256 return
257 }
258
259 // Otherwise, perform the operation immediately
260 performWriteOperations(operation, ctx)
261 },
262
263 writeUpdate(data: Partial<TRow> | Array<Partial<TRow>>) {
264 const operation: SyncOperation<TRow, TKey, TInsertInput> = {

Callers

nothing calls this directly

Calls 3

ensureContextFunction · 0.85
performWriteOperationsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected