eventful-sqlite 0.1.2 → 0.1.3
raw patch · 3 files changed
+48/−20 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- eventful-sqlite.cabal +1/−1
- tests/Eventful/Store/SqliteSpec.hs +39/−12
- tests/HLint.hs +8/−7
eventful-sqlite.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: eventful-sqlite-version: 0.1.2+version: 0.1.3 synopsis: SQLite implementations for eventful description: SQLite implementations for eventful category: Database,Eventsourcing,SQLite
tests/Eventful/Store/SqliteSpec.hs view
@@ -5,27 +5,54 @@ import Database.Persist.Sqlite import Test.Hspec -import Eventful.Serializer import Eventful.Store.Sqlite import Eventful.TestHelpers -makeStore :: (MonadIO m) => m (EventStore CounterEvent (SqlPersistT m), ConnectionPool)+spec :: Spec+spec = do+ describe "Sqlite event store" $ do+ eventStoreSpec sqliteStoreRunner+ sequencedEventStoreSpec sqliteStoreGlobalRunner++ -- This is really a test for runEventStoreUsing and+ -- runGloballyOrderedEventStoreUsing. This is just a good place to put it.+ describe "runEventStoreUsing and runGloballyOrderedEventStoreUsing for the sqlite store" $ do+ eventStoreSpec sqliteIOStoreRunner+ sequencedEventStoreSpec sqliteIOStoreGlobalRunner++makeStore :: IO (EventStore CounterEvent (SqlPersistT IO), ConnectionPool) makeStore = do pool <- liftIO $ runNoLoggingT (createSqlitePool ":memory:" 1) let store = serializedEventStore jsonStringSerializer $ sqliteEventStore defaultSqlEventStoreConfig initializeSqliteEventStore defaultSqlEventStoreConfig pool return (store, pool) -makeGlobalStore- :: (MonadIO m)- => m (EventStore CounterEvent (SqlPersistT m), GloballyOrderedEventStore CounterEvent (SqlPersistT m), ConnectionPool)-makeGlobalStore = do+sqliteStoreRunner :: EventStoreRunner (SqlPersistT IO)+sqliteStoreRunner = EventStoreRunner $ \action -> do (store, pool) <- makeStore+ runSqlPool (action store) pool++sqliteStoreGlobalRunner :: GloballyOrderedEventStoreRunner (SqlPersistT IO)+sqliteStoreGlobalRunner = GloballyOrderedEventStoreRunner $ \action -> do+ (store, pool) <- makeStore let globalStore = serializedGloballyOrderedEventStore jsonStringSerializer (sqlGloballyOrderedEventStore defaultSqlEventStoreConfig)- return (store, globalStore, pool)+ runSqlPool (action store globalStore) pool -spec :: Spec-spec = do- describe "Sqlite event store" $ do- eventStoreSpec makeStore (flip runSqlPool)- sequencedEventStoreSpec makeGlobalStore (flip runSqlPool)+makeIOStore :: IO (EventStore CounterEvent IO, ConnectionPool)+makeIOStore = do+ (store, pool) <- makeStore+ let store' = runEventStoreUsing (flip runSqlPool pool) store+ return (store', pool)++sqliteIOStoreRunner :: EventStoreRunner IO+sqliteIOStoreRunner = EventStoreRunner $ \action -> do+ (store, _) <- makeIOStore+ action store++sqliteIOStoreGlobalRunner :: GloballyOrderedEventStoreRunner IO+sqliteIOStoreGlobalRunner = GloballyOrderedEventStoreRunner $ \action -> do+ (store, pool) <- makeIOStore+ let+ globalStore = serializedGloballyOrderedEventStore jsonStringSerializer (sqlGloballyOrderedEventStore defaultSqlEventStoreConfig)+ globalStore' = runGloballyOrderedEventStoreUsing (flip runSqlPool pool) globalStore+ action store globalStore'
tests/HLint.hs view
@@ -7,13 +7,14 @@ arguments :: [String] arguments =- [ "src"- , "tests"- , "-i=Redundant do"- , "-i=Unused LANGUAGE pragma" -- This fails on DeriveGeneric- ]+ [ "src"+ , "tests"+ , "-i=Redundant do"+ , "-i=Unused LANGUAGE pragma" -- This fails on DeriveGeneric+ , "-i=Use section"+ ] main :: IO () main = do- hints <- hlint arguments- if null hints then exitSuccess else exitFailure+ hints <- hlint arguments+ if null hints then exitSuccess else exitFailure