eventsourcing-postgresql-0.9.0: PostgreSQL adaptor for eventsourcing.

Safe HaskellNone




type Projection event st = Projection event st SqlAction Source #

executeSqlActions :: forall streamId eventId action m st. (MonadError Error m, MonadIO m, ToField eventId, ToField streamId, ToField st) => ([action] -> [SqlAction]) -> (forall r. (Connection -> IO r) -> IO r) -> TrackingTable streamId eventId st -> Consumer (st, [action], streamId, eventId) m () Source #

Execute the SQL actions and update the tracking table in one transaction.

The custom actions are transformed into a list of SQL actions by the given function. See fromTabularDataActions for an example.

executeCustomActions Source #


:: (MonadError Error m, MonadIO m, ToField eventId, ToField streamId, ToField st) 
=> (action -> m (Either String (m ())))

Run an action returning either an error or a rollback action. If any of the rollback actions fail, the others are not run. Rollback actions are run in reversed order.

-> TrackingTable streamId eventId st 
-> Consumer (st, [action], streamId, eventId) m () 

Execute custom actions by calling the runner function on each action in turn and updating the tracking table accordingly.

fromTabularDataActions Source #


:: FromTabularDataAction cols 
=> Query

Relation name.

-> [TabularDataAction cols] 
-> [SqlAction]