MCPcopy
hub / github.com/colbymchenry/codegraph / transaction

Method transaction

src/db/sqlite-adapter.ts:109–121  ·  view source on GitHub ↗
(fn: (...args: any[]) => T)

Source from the content-addressed store, hash-verified

107 }
108
109 transaction<T>(fn: (...args: any[]) => T): (...args: any[]) => T {
110 return (...args: any[]) => {
111 this._db.exec('BEGIN');
112 try {
113 const result = fn(...args);
114 this._db.exec('COMMIT');
115 return result;
116 } catch (error) {
117 this._db.exec('ROLLBACK');
118 throw error;
119 }
120 };
121 }
122
123 close(): void {
124 // node:sqlite's DatabaseSync.close() throws if already closed; make it

Callers

nothing calls this directly

Calls 2

execMethod · 0.65
fnFunction · 0.50

Tested by

no test coverage detected