MCPcopy Index your code
hub / github.com/simstudioai/sim / deletePageByIds

Function deletePageByIds

apps/sim/lib/table/rows/ordering.ts:586–610  ·  view source on GitHub ↗
(
  tableId: string,
  workspaceId: string,
  rowIds: string[]
)

Source from the content-addressed store, hash-verified

584 * position. Returns the count deleted.
585 */
586export async function deletePageByIds(
587 tableId: string,
588 workspaceId: string,
589 rowIds: string[]
590): Promise<number> {
591 let deleted = 0
592 for (let i = 0; i < rowIds.length; i += TABLE_LIMITS.DELETE_BATCH_SIZE) {
593 const batch = rowIds.slice(i, i + TABLE_LIMITS.DELETE_BATCH_SIZE)
594 const rows = await db.transaction(async (trx) => {
595 await setTableTxTimeouts(trx, { statementMs: 60_000 })
596 return trx
597 .delete(userTableRows)
598 .where(
599 and(
600 eq(userTableRows.tableId, tableId),
601 eq(userTableRows.workspaceId, workspaceId),
602 inArray(userTableRows.id, batch)
603 )
604 )
605 .returning({ id: userTableRows.id })
606 })
607 deleted += rows.length
608 }
609 return deleted
610}
611
612/**
613 * Applies a JSONB-merge patch (`data || patchJson`) to a page of row ids, committed in

Callers 1

runTableDeleteFunction · 0.90

Calls 3

setTableTxTimeoutsFunction · 0.90
deleteMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected