0.0.8 • Published 4 years ago

estk-events-pg v0.0.8

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

estk-events-pg

postgresql storage for estk events

PostgresqlEventStorage

Event storage backed by a postgres database.

usage:

  const { createEventStore } = require('estk-events');
  const { PostgresClient } = require('estk-pg');
  const { PostgresEventStorage } = require('estk-events-pg');

  // client config
  const client = await PostgresClient({
    url: 'postgres://localhost/estk',
    // optional: number of connections
    poolSize: 10
  };

  const storage = await PostgresEventStorage(client);
  const store = await createEventStore({ storage });

  await store.publish({
    targetType: 'sandwich',
    targetId: '42',
    action: 'make',
    data: {
      flavor: 'roast beast'
    }
  });

  const eventStream = await store.getEventStream();
  const sandwichCount = await eventStream.reduce((count, action) => count++, 0);
0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.3

6 years ago

0.0.2

6 years ago