MCPcopy Index your code
hub / github.com/tinyplex/tinybase / addDataChangedTriggers

Function addDataChangedTriggers

src/persisters/common/database/postgresql.ts:136–152  ·  view source on GitHub ↗
(
    tableName: string,
    dataChangedFunction: string,
  )

Source from the content-addressed store, hash-verified

134 );
135
136 const addDataChangedTriggers = (
137 tableName: string,
138 dataChangedFunction: string,
139 ) =>
140 promiseAll(
141 arrayMap([INSERT, DELETE, UPDATE], (action, newOrOldOrBoth) =>
142 createTrigger(
143 OR_REPLACE,
144 escapeIds(TINYBASE, DATA_CHANGED, configHash, tableName, action),
145 `AFTER ${action} ON${escapeId(tableName)}FOR EACH ROW WHEN(${when(
146 tableName,
147 newOrOldOrBoth as 0 | 1 | 2,
148 )})`,
149 dataChangedFunction,
150 ),
151 ),
152 );
153
154 const addPersisterListener = async (
155 listener: PersisterListener<Persist>,

Callers 1

addPersisterListenerFunction · 0.85

Calls 6

promiseAllFunction · 0.90
arrayMapFunction · 0.90
escapeIdsFunction · 0.90
escapeIdFunction · 0.90
createTriggerFunction · 0.85
whenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…