MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / upsert

Function upsert

packages/core/fumadb/src/adapters/memory/index.ts:169–176  ·  view source on GitHub ↗
(table, v)

Source from the content-addressed store, hash-verified

167 }
168 },
169 async upsert(table, v) {
170 const existing = tableRows(db, table).find((row) => matchesCondition(row, v.where));
171 if (existing) {
172 Object.assign(existing, cloneValue(v.update));
173 return;
174 }
175 await this.create(table, v.create);
176 },
177 async create(table, values) {
178 const row = applyDefaults(table, values);
179 tableRows(db, table).push(row);

Callers

nothing calls this directly

Calls 3

tableRowsFunction · 0.85
matchesConditionFunction · 0.85
cloneValueFunction · 0.85

Tested by

no test coverage detected