Safe Haskell | None |
---|---|
Language | Haskell2010 |
A projection is an aggregation of all messages in a stream.
Synopsis
- data Projection state = Projection {
- initial :: state
- handlers :: ProjectionHandlers state
- data UnprocessedMessage = UnprocessedMessage {
- message :: Message
- reason :: HandleError
- data Projected state = Projected {
- unprocessed :: [UnprocessedMessage]
- state :: state
- version :: StreamVersion
- versionIncludingUnprocessed :: Projected state -> StreamVersion
- project :: Projection state -> NonEmpty Message -> Projected state
- fetch :: forall state. WithConnection -> BatchSize -> StreamName -> Projection state -> IO (Maybe (Projected state))
- newtype SnapshotStreamName = SnapshotStreamName {}
- fetchWithSnapshots :: forall state. (ToJSON state, FromJSON state) => WithConnection -> BatchSize -> StreamName -> Projection state -> SnapshotStreamName -> IO (Maybe (Projected state))
Documentation
data Projection state Source #
Defines how to perform a projection a stream.
Projection | |
|
data UnprocessedMessage Source #
A message that was not able to be processed.
Instances
Eq UnprocessedMessage Source # | |
Defined in MessageDb.Projection (==) :: UnprocessedMessage -> UnprocessedMessage -> Bool # (/=) :: UnprocessedMessage -> UnprocessedMessage -> Bool # | |
Show UnprocessedMessage Source # | |
Defined in MessageDb.Projection showsPrec :: Int -> UnprocessedMessage -> ShowS # show :: UnprocessedMessage -> String # showList :: [UnprocessedMessage] -> ShowS # | |
Exception UnprocessedMessage Source # | |
Defined in MessageDb.Projection |
A projected state
Projected | |
|
versionIncludingUnprocessed :: Projected state -> StreamVersion Source #
Version of the projection with unprocessed messages included.
project :: Projection state -> NonEmpty Message -> Projected state Source #
Project a state of a stream by aggregating messages.
fetch :: forall state. WithConnection -> BatchSize -> StreamName -> Projection state -> IO (Maybe (Projected state)) Source #
Query a stream and project the messages.
newtype SnapshotStreamName Source #
Instances
fetchWithSnapshots :: forall state. (ToJSON state, FromJSON state) => WithConnection -> BatchSize -> StreamName -> Projection state -> SnapshotStreamName -> IO (Maybe (Projected state)) Source #