Class TransactionManagerAbstract

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

  • TransactionManager

    Constructors

    Methods

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

      Type Parameters

      • Result = void

      Parameters

      • transaction: Transaction

        The transaction in which the savepoint will be created.

      • callback: ((nestedTransaction: Transaction) => Promise<Result>)

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

      Returns Promise<Result>

      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.

      Type Parameters

      • Result = void

      Parameters

      • callback: ((transaction: Transaction) => Promise<Result>)

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

      Returns Promise<Result>

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