Beignet API reference
    Preparing search index...

    Interface DrizzlePostgresUnitOfWorkOptions<TSchema, TxPorts>

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

    interface DrizzlePostgresUnitOfWorkOptions<
        TSchema extends Record<string, unknown>,
        TxPorts,
    > {
        createTransactionPorts: (
            db: DrizzlePostgresTransaction<TSchema>,
            events: BufferedDomainEventRecorder,
        ) => TxPorts;
        db: DrizzlePostgresDatabase<TSchema>;
        eventBus?: EventBusPort;
        transactionConfig?: PgTransactionConfig;
    }

    Type Parameters

    • TSchema extends Record<string, unknown>
    • TxPorts
    Index
    createTransactionPorts: (
        db: DrizzlePostgresTransaction<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?: PgTransactionConfig

    Optional Drizzle transaction configuration.