# EventStore

CQRS Event Store implemented in Elixir.

Uses [PostgreSQL]( as the underlying storage. Requires version 9.5 or newer.

## Sample usage

# start the `EventStore` process
{:ok, store} = EventStore.Storage.start_link

# ensure PostgreSQL tables exist (create if not present) 

# create a unique identity for the stream (e.g. an aggregate id)
uuid = UUID.uuid4()

# list of events to persist
events = [
  	event_type: "ExampleEvent",
    headers: %{user: ""},
    payload: %ExampleEvent{key: "value"}

{:ok, events} = EventStore.Storage.append_to_stream(store, uuid, 0, events)

## Installation

If [available in Hex](, the package can be installed as:

  1. Add eventstore to your list of dependencies in `mix.exs`:

        def deps do
          [{:eventstore, "~> 0.0.1"}]

  2. Ensure eventstore is started before your application:

        def application do
          [applications: [:eventstore]]