Beignet API reference
    Preparing search index...

    Interface DrizzleMysqlUnitOfWorkOptions<TSchema, TxPorts>

    Options for creating a Drizzle MySQL-backed Unit of Work port.

    interface DrizzleMysqlUnitOfWorkOptions<
        TSchema extends Record<string, unknown>,
        TxPorts,
    > {
        createTransactionPorts: (
            db: DrizzleMysqlTransaction<TSchema>,
            events: BufferedDomainEventRecorder,
        ) => TxPorts;
        db: DrizzleMysqlDatabase<TSchema>;
        eventBus?: EventBusPort;
        transactionConfig?: MySqlTransactionConfig;
    }

    Type Parameters

    • TSchema extends Record<string, unknown>
    • TxPorts
    Index
    createTransactionPorts: (
        db: DrizzleMysqlTransaction<TSchema>,
        events: BufferedDomainEventRecorder,
    ) => TxPorts

    Create transaction-scoped ports from the Drizzle transaction client.

    The event recorder is transaction-local. Record domain events inside the callback and pass eventBus to publish them after the database commit.

    The root Drizzle database instance from ctx.ports.db.drizzle.

    eventBus?: EventBusPort

    Optional event bus used to flush recorded domain events after commit.

    transactionConfig?: MySqlTransactionConfig

    Optional Drizzle transaction configuration.