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

Function jsonbCastForType

apps/sim/lib/table/sql.ts:40–49  ·  view source on GitHub ↗

* Returns the Postgres cast needed to compare a JSONB text value of the given * column type, or `null` when text comparison is correct. Single source of * truth for both filter range operators and sort ordering — keeps the two * paths from drifting apart.

(type: ColumnType | undefined)

Source from the content-addressed store, hash-verified

38 * paths from drifting apart.
39 */
40function jsonbCastForType(type: ColumnType | undefined): 'numeric' | 'timestamptz' | null {
41 switch (type) {
42 case 'number':
43 return 'numeric'
44 case 'date':
45 return 'timestamptz'
46 default:
47 return null
48 }
49}
50
51/**
52 * Maps a column's **stable id** (the JSONB storage key, via `getColumnId`) to

Callers 2

buildComparisonClauseFunction · 0.85
buildSortFieldClauseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected