interface InMemoryConnector

Creates an in-memory event log connector for testing and development.

Events are stored in memory and lost when the process exits. Ideal for unit tests, prototyping, and development environments.

Examples

Basic usage

import { EventLog, createInMemory } from "@anabranch/eventlog";

const connector = createInMemory();
const log = await EventLog.connect(connector).run();

await log.append("users", { userId: 123 }).run();

// After testing, clean up
await connector.end();

With custom partition key

const connector = createInMemory({
  defaultPartitionKey: "user-events",
});

Methods

end(): Promise<void>

Usage

import { type InMemoryConnector } from ".";