Run transactions against event stores.

- data TransactionT e m a
- getAggregateRoot :: (Default a, Serialize e, Typeable a, Typeable e, Aggregate a, Eventable a e) => GUID a -> TransactionT e IO (AggregateRef a e, a)
- publishEvent :: (MonadIO m, Serialize e, Eventable a e) => AggregateRef a e -> e -> TransactionT e m ()
- retrieveEvents :: forall e. Serialize e => Int -> Int -> (e -> IO ()) -> TransactionT e IO ()
- runTransactionT :: (Typeable e, Serialize e) => EventStore -> TransactionT e IO c -> IO c

# Documentation

data TransactionT e m a Source

Transaction monad transformer.

MonadTrans (TransactionT e) | |

Monad m => Monad (TransactionT e m) | |

Functor m => Functor (TransactionT e m) |

getAggregateRoot :: (Default a, Serialize e, Typeable a, Typeable e, Aggregate a, Eventable a e) => GUID a -> TransactionT e IO (AggregateRef a e, a)Source

Get aggregate root.

publishEvent :: (MonadIO m, Serialize e, Eventable a e) => AggregateRef a e -> e -> TransactionT e m ()Source

Publish event for an aggregate root.

retrieveEvents :: forall e. Serialize e => Int -> Int -> (e -> IO ()) -> TransactionT e IO ()Source

Retrieve a range of events, invoking a callback function for each event. For example,

retrieveEvents 10 20 $ \e -> do putStrLn $ "Event: " ++ show e

would print all events between logical time 20 (inclusive) and logical time 30 (not inclusive). Logical time starts at 1. It is NOT an error to provide bounds for which there are no events.

runTransactionT :: (Typeable e, Serialize e) => EventStore -> TransactionT e IO c -> IO cSource

Run transaction against an event store.