We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isExcusive
transaction
1 parent 5ec8a19 commit e0c08ccCopy full SHA for e0c08cc
package/src/operations/transaction.ts
@@ -22,7 +22,8 @@ export interface PendingTransaction {
22
23
export const transaction = (
24
dbName: string,
25
- fn: (tx: Transaction) => Promise<void> | void
+ fn: (tx: Transaction) => Promise<void> | void,
26
+ isExclusive = false
27
): Promise<void> => {
28
if (locks[dbName] == null)
29
throw Error(`Nitro SQLite Error: No lock found on db: ${dbName}`)
@@ -78,7 +79,10 @@ export const transaction = (
78
79
80
async function run() {
81
try {
- await HybridNitroSQLite.executeAsync(dbName, 'BEGIN TRANSACTION')
82
+ await HybridNitroSQLite.executeAsync(
83
+ dbName,
84
+ isExclusive ? 'BEGIN EXCLUSIVE TRANSACTION' : 'BEGIN TRANSACTION'
85
+ )
86
87
await fn({
88
commit,
0 commit comments