Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Stream identifier metadata event
- makeStream :: forall identifier metadata event. (WritableEvent event, ToField (EncodingFormat event), ToField identifier, ToRow metadata) => (forall a. (Connection -> IO a) -> IO a) -> Query -> Query -> [Query] -> Query -> Stream identifier metadata event
- makeStream' :: (ToRow r, ToRow r') => (forall a. (Connection -> IO a) -> IO a) -> (Query, r) -> (forall encEvent. (ToField encEvent, ToRow metadata) => encEvent -> metadata -> ConsistencyCheck identifier -> (Query, r')) -> Query -> Stream identifier metadata event
Documentation
data Stream identifier metadata event Source #
Stream of events stored in a PostgreSQL relation.
The job of sharding streams in different tables is left to the database. If this is something you want to do, you can create a view and a trigger on insert into that view.
Instances
(Event event, MonadError Error m, MonadIO m, Ord identifier, FromField identifier, ToField identifier, FromRow metadata, FromField (EncodingFormat event)) => Stream m (Stream identifier metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.Stream type EventType (Stream identifier metadata event) :: Type # type EventIdentifier (Stream identifier metadata event) :: Type # type EventMetadata (Stream identifier metadata event) :: Type # streamEvents :: Stream identifier metadata event -> StreamBounds' (Stream identifier metadata event) -> Producer [Either (EventIdentifier (Stream identifier metadata event), String) (EventWithContext' (Stream identifier metadata event))] m () # | |
(WritableEvent event, MonadError Error m, MonadIO m, Ord identifier, FromField identifier, ToField identifier, FromField (EncodingFormat event), ToField (EncodingFormat event), FromRow metadata, ToRow metadata) => WritableStream m (Stream identifier metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.Stream writeEventWithMetadata :: Stream identifier metadata event -> EventType (Stream identifier metadata event) -> EventMetadata (Stream identifier metadata event) -> ConsistencyCheck (EventIdentifier (Stream identifier metadata event)) -> m (EventIdentifier (Stream identifier metadata event)) # | |
type EventMetadata (Stream identifier metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.Stream | |
type EventIdentifier (Stream identifier metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.Stream | |
type EventType (Stream identifier metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.Stream |
:: (WritableEvent event, ToField (EncodingFormat event), ToField identifier, ToRow metadata) | |
=> (forall a. (Connection -> IO a) -> IO a) | Connection pool as a function. |
-> Query | Relation name. |
-> Query | Identifier column name. If there are several, use a tuple. |
-> [Query] | Column names for metadata. |
-> Query | Event column name. |
-> Stream identifier metadata event |
Make a Stream
from basic information about the relation name and columns.
:: (ToRow r, ToRow r') | |
=> (forall a. (Connection -> IO a) -> IO a) | Connection pool as a function. |
-> (Query, r) | Select query. |
-> (forall encEvent. (ToField encEvent, ToRow metadata) => encEvent -> metadata -> ConsistencyCheck identifier -> (Query, r')) | Insert query builder. |
-> Query | Identifier column (use tuple if several.) |
-> Stream identifier metadata event |
Make a stream from queries.
This function is less safe than makeStream
and should only be used when
makeStream
is not flexible enough. It is also closer to the implementation
and more subject to changes.