Collection of libraries for interacting with Eventide's Message DB via PostgreSQL. The purpose of these libraries are to make it easier to implement event sourcing systems in Haskell.
For an example of how this library is used, please see BankAccount.hs.
- This library is an unofficial message-db client library for Haskell.
- Only
message-db-temp
has been published to hackage so far. - If you want to use the
message-db
ormessage-db-monad
packages then you need to add the following:- For
cabal
add the following tocabal.project
source-repository-package type: git location: https://github.com/Disco-Dave/message-db.git tag: 359cb51b69efbf8f561c2709973db713c8154a34 subdir: message-db message-db-monad
- For
stack
add the follow tostack.yaml
extra-deps: - git: https://github.com/Disco-Dave/message-db.git commit: 359cb51b69efbf8f561c2709973db713c8154a34 subdirs: - message-db - message-db-monad
- Note: you may replace
359cb51b69efbf8f561c2709973db713c8154a34
with any git ref you want
- For
This repository contains the following packages:
- message-db - Low-level library built on top of postgresql-simple.
- message-db-temp - Creates temporary message-db instances using tmp-postgres and the official message-db scripts. This package is also used by message-db tests for running integration tests.
- message-db-monad - Utilizes MonadUnliftIO to allow running message-db actions in a custom monad.
If you find a bug, have a feature request, or simply have a question then please open an issue.
Currently this project supports that last three major versions of ghc
with cabal
, and the last two major lts
snapshots plus nightly
for stack
.
If you need to setup ghc
, cabal
, or stack
; then I highly recommend using ghcup.
Regardless of which tool chain you use, the first thing you'll need to do is clone the repo and initialize all of the submodules. This may be done with one command:
git clone https://github.com/Disco-Dave/message-db.git --recurse-submodules
Or if you already cloned the repo, then you may run the following inside of the repo folder to initialize the submodules:
git submodule update --init --recursive
You may also need some additional system dependencies in order to build, if you're on a Debian based system then run the following:
apt update && apt install -y libpq-dev
If you also wish to run the test-suite, then you need to make sure that initdb
is on your path. If you're on a Debian based system then run the following:
apt update && apt install -y postgresql
export PATH=/usr/lib/postgresql/13/bin:$PATH
Note, your distro may have a postgresql
version different from 13. If so, replace the 13 in your PATH
with the appropriate number.
cabal update
- Ensures you have the latest package list from Hackage.cabal build all
- Builds all packages.cabal test all
- Runs the test-suite for all packages.
stack init
- Initializes the stack project. You can also specify a specificresolver
instead:stack init --resolver lts-18
stack init --resolver lts-19
stack init --resolver nightly
stack build
- Builds all packages.stack test
- Runs the test-suite for all packages.