Skip to content

Database.transaction() method

Home > @direct-sqlite/core > Database > transaction

Executes a series of database operations within a transaction. If any operation throws an error, the transaction will be rolled back.

Signature:

transaction<T>(callback: () => T): T;

Parameter

Type

Description

callback

() => T

Function containing the database operations to execute within the transaction.

Returns:

T

The value returned by the callback function if the transaction commits successfully.