eventsourcing-postgresql-0.9.0: PostgreSQL adaptor for eventsourcing.

Safe HaskellNone
LanguageHaskell2010

Database.CQRS.PostgreSQL.TrackingTable

Synopsis

Documentation

data TrackingTable streamId eventId st Source #

Instances
(MonadError Error m, MonadIO m, FromField eventId, FromField st, FromField streamId, ToField eventId, ToField st, ToField streamId) => TrackingTable m (TrackingTable streamId eventId st) streamId eventId st Source # 
Instance details

Defined in Database.CQRS.PostgreSQL.TrackingTable

Methods

getTrackedState :: TrackingTable streamId eventId st -> streamId -> m (TrackedState eventId st) #

upsertError :: TrackingTable streamId eventId st -> streamId -> eventId -> String -> m () #

createTrackingTable Source #

Arguments

:: (MonadError Error m, MonadIO m) 
=> (forall r. (Connection -> IO r) -> IO r) 
-> Query

Name of the tracking table.

-> Query

Type of stream identifiers.

-> Query

Type of event identifiers.

-> Query

Type of the state.

-> m (TrackingTable streamId eventId st) 

Create tracking table if it doesn't exist already.

A tracking table is a table used to track the last events processed by a projection for each stream in a stream family. It allows them to restart from where they have left off.

upsertTrackingTable Source #

Arguments

:: (ToField streamId, ToField eventId, ToField st) 
=> TrackingTable streamId eventId st 
-> streamId 
-> eventId 
-> Either String st

The new state or the error message if it failed.

-> SqlAction 

Return SQL query to upsert a row in a tracking table.

doUpsertTrackingTable Source #

Arguments

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

The new state or the error message if it failed.

-> m () 

Update the tracking table for the given stream.