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 d1d6f99 commit 7f6e1edCopy full SHA for 7f6e1ed
package/src/operations/transaction.ts
@@ -11,7 +11,8 @@ import NitroSQLiteError from '../NitroSQLiteError'
11
12
export const transaction = (
13
dbName: string,
14
- fn: (tx: Transaction) => Promise<void> | void
+ fn: (tx: Transaction) => Promise<void> | void,
15
+ isExclusive = false
16
): Promise<void> => {
17
throwIfDatabaseIsNotOpen(dbName)
18
@@ -67,7 +68,10 @@ export const transaction = (
67
68
try {
69
return queueOperationAsync(dbName, async () => {
70
- await HybridNitroSQLite.executeAsync(dbName, 'BEGIN TRANSACTION')
71
+ await HybridNitroSQLite.executeAsync(
72
+ dbName,
73
+ isExclusive ? 'BEGIN EXCLUSIVE TRANSACTION' : 'BEGIN TRANSACTION'
74
+ )
75
76
await fn({
77
commit,
0 commit comments