@hackage eventium-sqlite0.5.2
SQLite implementations for eventium
Installation
Dependencies (9)
- aeson >=1.5 && <2.3
- base >=4.9 && <5
- bytestring >=0.10 && <0.13
- eventium-core >=0.5.0 && <0.6.0
- eventium-sql-common >=0.5.0 && <0.6.0
- mtl >=2.2 && <2.4 Show all…
Dependents (0)
Package Flags
ci
(off by default)
Enable -Werror for CI builds
Eventium SQLite
SQLite event store backend for Eventium.
Overview
eventium-sqlite provides a lightweight, file-based event store using SQLite.
Ideal for CLI tools, single-process applications, and development environments
where a full database server is unnecessary.
API
sqliteEventStoreWriter
:: (MonadIO m)
=> SqlEventStoreConfig entity serialized
-> VersionedEventStoreWriter (SqlPersistT m) serialized
initializeSqliteEventStore
:: (MonadIO m)
=> SqlEventStoreConfig entity serialized
-> ConnectionPool
-> m ()
Readers come from eventium-sql-common (re-exported):
sqlEventStoreReader :: SqlEventStoreConfig entity serialized -> VersionedEventStoreReader (SqlPersistT m) serialized
sqlGlobalEventStoreReader :: SqlEventStoreConfig entity serialized -> GlobalEventStoreReader (SqlPersistT m) serialized
Usage
import Eventium.Store.Sqlite
import Database.Persist.Sqlite
main :: IO ()
main = runNoLoggingT $ do
pool <- createSqlitePool "events.db" 1
liftIO $ initializeSqliteEventStore defaultSqlEventStoreConfig pool
let writer = sqliteEventStoreWriter defaultSqlEventStoreConfig
reader = sqlEventStoreReader defaultSqlEventStoreConfig
-- writer and reader operate in SqlPersistT m
initializeSqliteEventStore runs migrations and creates a UUID index.
When to Use
| Scenario | Recommendation |
|---|---|
| CLI tools, desktop apps | SQLite |
| Development / prototyping | SQLite or Memory |
| Multi-process / production | PostgreSQL |
| Unit tests (no persistence needed) | Memory |
Installation
dependencies:
- eventium-core
- eventium-sqlite
- persistent-sqlite
Documentation
- Main README
- SQL Common
- Design
- Cafe Example and Bank Example both use SQLite
License
MIT -- see LICENSE.md