Represents an abstract class for managing transactions in a Domain-Driven Design (DDD) framework. This class sets a transactional boundary by passing an async callback with a transaction at the top of the context.

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

db: NodePgDatabase

Methods

  • Creates a savepoint within the specified transaction and executes the provided callback within the savepoint context.

    Parameters

    • transaction: PgTransaction

      The transaction in which the savepoint will be created.

    • callback: ((nestedTransaction: PgTransaction) => Promise<void>)

      The async callback function that will be executed within the savepoint context.

        • (nestedTransaction): Promise<void>
        • Parameters

          Returns Promise<void>

    Returns Promise<void>

    A Promise that resolves when the savepoint and the callback have completed successfully.

  • Starts a new transaction and executes the provided callback within the transaction context.

    Parameters

    • callback: ((transaction: PgTransaction) => Promise<void>)

      The async callback function that will be executed within the transaction context.

        • (transaction): Promise<void>
        • Parameters

          Returns Promise<void>

    Returns Promise<void>

    A Promise that resolves when the transaction and the callback have completed successfully.