Hermes PostgreSQL
    Preparing search index...

    Type Alias QueryExecutor

    Runs a SQL query with positional parameters ($1, $2, ...).

    Wrap the transaction of the library your app uses, so that Hermes stores messages in it. pg clients (PoolClient, Client) and TypeORM's QueryRunner satisfy it as they are.

    // node-postgres
    const client = await pool.connect()
    await client.query('BEGIN')
    await outbox.queue(event, { tx: client })
    await client.query('COMMIT')

    // Prisma
    await prisma.$transaction(async (tx) => {
    await outbox.queue(event, { tx: { query: (text, params) => tx.$executeRawUnsafe(text, ...params) } })
    })
    type QueryExecutor = {
        query: (text: string, params: unknown[]) => Promise<unknown>;
    }
    Index
    query: (text: string, params: unknown[]) => Promise<unknown>