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

Function transaction

packages/core/fumadb/src/adapters/memory/index.ts:192–201  ·  view source on GitHub ↗
(run: (transactionInstance: AbstractQuery<AnySchema>) => Promise<T>)

Source from the content-addressed store, hash-verified

190 db[table.ormName] = rows.filter((row) => !matchesCondition(row, v.where));
191 },
192 async transaction<T>(run: (transactionInstance: AbstractQuery<AnySchema>) => Promise<T>) {
193 const snapshot = cloneValue(db);
194 try {
195 return await run(orm);
196 } catch (error) {
197 for (const key of Object.keys(db)) delete db[key];
198 Object.assign(db, snapshot);
199 throw error;
200 }
201 },
202 });
203 return orm;
204 },

Callers

nothing calls this directly

Calls 2

cloneValueFunction · 0.85
runFunction · 0.50

Tested by

no test coverage detected