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

Function coerceRowValues

apps/sim/lib/table/validation.ts:326–339  ·  view source on GitHub ↗
(data: RowData, schema: TableSchema)

Source from the content-addressed store, hash-verified

324 * from `data` are skipped — it never invents a missing-required-field error).
325 */
326export function coerceRowValues(data: RowData, schema: TableSchema): void {
327 for (const column of schema.columns) {
328 const key = getColumnId(column)
329 const value = data[key]
330 if (value === null || value === undefined) continue
331
332 const coerced = coerceValueToColumnType(value, column.type)
333 if (coerced.ok) {
334 data[key] = coerced.value
335 } else if (!column.required) {
336 data[key] = null
337 }
338 }
339}
340
341/**
342 * Coerces a full row toward its schema **in place** (see {@link coerceRowValues})

Callers 4

runTableUpdateFunction · 0.90
updateRowsByFilterFunction · 0.90
validation.test.tsFile · 0.90
coerceRowToSchemaFunction · 0.85

Calls 2

getColumnIdFunction · 0.90
coerceValueToColumnTypeFunction · 0.85

Tested by

no test coverage detected