Skip to content

Commit 91abc20

Browse files
committed
refactor: rename variable
1 parent 72cfc74 commit 91abc20

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

package/src/operations/transaction.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export const transaction = async <Result = void>(
1515
) => {
1616
throwIfDatabaseIsNotOpen(dbName)
1717

18-
let isFinalized = false
18+
let isFinished = false
1919

2020
const executeOnTransaction = <Row extends QueryResultRow = never>(
2121
query: string,
2222
params?: SQLiteQueryParams,
2323
): QueryResult<Row> => {
24-
if (isFinalized) {
24+
if (isFinished) {
2525
throw new NitroSQLiteError(
2626
`Cannot execute query on finalized transaction: ${dbName}`,
2727
)
@@ -33,7 +33,7 @@ export const transaction = async <Result = void>(
3333
query: string,
3434
params?: SQLiteQueryParams,
3535
): Promise<QueryResult<Row>> => {
36-
if (isFinalized) {
36+
if (isFinished) {
3737
throw new NitroSQLiteError(
3838
`Cannot execute query on finalized transaction: ${dbName}`,
3939
)
@@ -42,22 +42,22 @@ export const transaction = async <Result = void>(
4242
}
4343

4444
const commit = () => {
45-
if (isFinalized) {
45+
if (isFinished) {
4646
throw new NitroSQLiteError(
4747
`Cannot execute commit on finalized transaction: ${dbName}`,
4848
)
4949
}
50-
isFinalized = true
50+
isFinished = true
5151
return execute(dbName, 'COMMIT')
5252
}
5353

5454
const rollback = () => {
55-
if (isFinalized) {
55+
if (isFinished) {
5656
throw new NitroSQLiteError(
5757
`Cannot execute rollback on finalized transaction: ${dbName}`,
5858
)
5959
}
60-
isFinalized = true
60+
isFinished = true
6161
return execute(dbName, 'ROLLBACK')
6262
}
6363

@@ -75,11 +75,11 @@ export const transaction = async <Result = void>(
7575
rollback,
7676
})
7777

78-
if (!isFinalized) commit()
78+
if (!isFinished) commit()
7979

8080
return result
8181
} catch (executionError) {
82-
if (!isFinalized) {
82+
if (!isFinished) {
8383
try {
8484
rollback()
8585
} catch (rollbackError) {

0 commit comments

Comments
 (0)