Method
transaction
(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
Tested by
no test coverage detected