@arpinum/eventstore
v2.2.6
Published
Simple event store based on PostgreSQL
Downloads
9
Maintainers
Readme
@arpinum/eventstore
We won't really know what will happen until it happens.
Helen Thomas
@arpinum/eventstore contains a simple event store based on PostgreSQL.
The event store allows you to persist events in a database and query them with some criteria like type.
Installation
npm install @arpinum/eventstore --save
Example
const connectionString = "postgres://postgres@localhost:5432/eventstore";
const store = createEventStore({ connectionString });
await store.add({
type: "UserSignedUp",
date: new Date(),
targetType: "User",
targetId: "bf04b429-4c88-46de-a2ae-15624c75fd56",
payload: {
login: "johndoe",
},
});
await store
.find({ type: "UserSignedUp" })
.on("data", (event) => console.log("Event found:", event));
More examples in examples.