| Copyright | (c) 2024 |
|---|---|
| License | BSD3 |
| Maintainer | maintainer@example.com |
| Stability | internal |
| Safe Haskell | None |
| Language | GHC2021 |
Hindsight.Store.PostgreSQL.Events.Insertion
Description
Handles the insertion of events into PostgreSQL tables, including transaction management, sequence number assignment, stream head updates, and optional synchronous projection execution.
Synopsis
- data InsertedEvents = InsertedEvents {}
- insertEventsWithSyncProjections :: forall (t :: Type -> Type). Traversable t => SyncProjectionRegistry -> Maybe CorrelationId -> Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> IO (Transaction InsertedEvents)
- calculateStreamVersions :: forall (t :: Type -> Type). Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> Transaction (Map StreamId StreamVersion)
- nextStreamVersions :: forall (t :: Type -> Type). Foldable t => Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> Map StreamId StreamVersion -> Map StreamId [StreamVersion]
Types
data InsertedEvents Source #
Result of event insertion
Constructors
| InsertedEvents | |
Fields
| |
Main insertion functions
insertEventsWithSyncProjections :: forall (t :: Type -> Type). Traversable t => SyncProjectionRegistry -> Maybe CorrelationId -> Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> IO (Transaction InsertedEvents) Source #
Insert events and execute synchronous projections within the same transaction
Stream version utilities
calculateStreamVersions :: forall (t :: Type -> Type). Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> Transaction (Map StreamId StreamVersion) Source #
Calculate stream versions for events based on current stream state
nextStreamVersions :: forall (t :: Type -> Type). Foldable t => Map StreamId (StreamWrite t SomeLatestEvent SQLStore) -> Map StreamId StreamVersion -> Map StreamId [StreamVersion] Source #
Calculate next stream versions for each stream