{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilyDependencies #-}
module Persistent.EventSource.EventStore where
import Persistent.EventSource.Projection
import Control.Monad.IO.Unlift
import Database.Persist.Monad(MonadSqlQuery)
import Database.Persist.Class.PersistEntity
class Projection a => EventStore a where
storeMany :: (MonadIO m, MonadSqlQuery m) => [Event a] -> m [Key (Event a)]
getLastAppliedEventId :: (MonadIO m, MonadSqlQuery m) => m (Maybe (Key (Event a)))
markEventsApplied :: (MonadIO m, MonadSqlQuery m) => [Key (Event a)] -> m ()
loadUnappliedEvents :: (MonadIO m, MonadSqlQuery m) => Maybe (Key (Event a)) -> m [Entity (Event a)]