Function transaction

  • Encapsulates a series of data operations into an independent transaction. These operations either succeed or fail at all.

    In addition, success or failure does not affect external operations, and success or failure of external operations does not affect the result of transaction.

    Parameters

    • operation: Operation

      Database operation function

    Returns void

    Example


    import { transaction } from 'db';

    let op = function(): void {
    // Perform some database operations.
    }

    transaction(op);