event-sourcing
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.EventSource

Description

The types and functions for creating EventSource and EventSink handles, intended to be used as an extension point.

A single EventSource and zero or more EventSink handles let an application load and emit an ordered, identified event stream. SQLite is a ready-made implementation.

Synopsis

Documentation

class HasEventId a where Source #

Methods

getEventId :: a -> EventId Source #

Instances

Instances details
HasEventId Word64 Source # 
Instance details

Defined in Data.EventSource

newtype EventSource e m Source #

Constructors

EventSource 

Fields

getEvents :: (HasEventId e, MonadUnliftIO m) => EventSource e m -> m [e] Source #

Retrieve all events from the event source as a list.

data EventSink e m Source #

Constructors

EventSink 

Fields

mkEventSink :: Monad m => (HasEventId e => e -> m ()) -> EventSink e m Source #

Create an EventSink from a single-event function, with a default sequential batch implementation.

putEventsToSinks :: (Monad m, HasEventId e) => [EventSink e m] -> [e] -> m () Source #

Put a list of events to a list of event sinks, batching per sink.