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

Function getRowById

apps/sim/lib/table/rows/service.ts:1069–1099  ·  view source on GitHub ↗
(
  tableId: string,
  rowId: string,
  workspaceId: string
)

Source from the content-addressed store, hash-verified

1067 * @returns Row or null if not found
1068 */
1069export async function getRowById(
1070 tableId: string,
1071 rowId: string,
1072 workspaceId: string
1073): Promise<TableRow | null> {
1074 const results = await db
1075 .select()
1076 .from(userTableRows)
1077 .where(
1078 and(
1079 eq(userTableRows.id, rowId),
1080 eq(userTableRows.tableId, tableId),
1081 eq(userTableRows.workspaceId, workspaceId)
1082 )
1083 )
1084 .limit(1)
1085
1086 if (results.length === 0) return null
1087
1088 const row = results[0]
1089 const executions = await loadExecutionsForRow(db, row.id)
1090 return {
1091 id: row.id,
1092 data: row.data as RowData,
1093 executions,
1094 position: row.position,
1095 orderKey: row.orderKey ?? undefined,
1096 createdAt: row.createdAt,
1097 updatedAt: row.updatedAt,
1098 }
1099}
1100
1101/** Internal: thrown inside `db.transaction` to roll back when the executions
1102 * guard rejects a write. The outer `.catch` translates it into a `null` return. */

Callers 8

executeFunction · 0.90
writeWorkflowGroupStateFunction · 0.85
updateRowFunction · 0.85
runRowCascadeLoopFunction · 0.85
executeResumeJobFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected