domaindriven-core-0.5.0: Batteries included event sourcing and CQRS
Safe HaskellSafe-Inferred
LanguageHaskell2010

DomainDriven.Persistance.Class

Synopsis

Documentation

class ReadModel p where Source #

Associated Types

type Model p :: Type Source #

type Event p :: Type Source #

Methods

applyEvent :: p -> Model p -> Stored (Event p) -> Model p Source #

getModel :: p -> IO (Model p) Source #

getEventList :: p -> IO [Stored (Event p)] Source #

getEventStream :: p -> SerialT IO (Stored (Event p)) Source #

class ReadModel p => WriteModel p where Source #

Methods

transactionalUpdate :: forall m a. MonadUnliftIO m => p -> (Model p -> m (Model p -> a, [Event p])) -> m a Source #

Instances

Instances details
WriteModel (ForgetfulInMemory model e) Source # 
Instance details

Defined in DomainDriven.Persistance.ForgetfulInMemory

Methods

transactionalUpdate :: MonadUnliftIO m => ForgetfulInMemory model e -> (Model (ForgetfulInMemory model e) -> m (Model (ForgetfulInMemory model e) -> a, [Event (ForgetfulInMemory model e)])) -> m a Source #

(ToJSON e, FromJSON e) => WriteModel (PostgresEvent m e) Source # 
Instance details

Defined in DomainDriven.Persistance.Postgres.Internal

Methods

transactionalUpdate :: MonadUnliftIO m0 => PostgresEvent m e -> (Model (PostgresEvent m e) -> m0 (Model (PostgresEvent m e) -> a, [Event (PostgresEvent m e)])) -> m0 a Source #

data Stored a Source #

Wrapper for stored data This ensures all events have a unique ID and a timestamp, without having to deal with that when implementing the model.

Constructors

Stored 

Instances

Instances details
Foldable Stored Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

fold :: Monoid m => Stored m -> m #

foldMap :: Monoid m => (a -> m) -> Stored a -> m #

foldMap' :: Monoid m => (a -> m) -> Stored a -> m #

foldr :: (a -> b -> b) -> b -> Stored a -> b #

foldr' :: (a -> b -> b) -> b -> Stored a -> b #

foldl :: (b -> a -> b) -> b -> Stored a -> b #

foldl' :: (b -> a -> b) -> b -> Stored a -> b #

foldr1 :: (a -> a -> a) -> Stored a -> a #

foldl1 :: (a -> a -> a) -> Stored a -> a #

toList :: Stored a -> [a] #

null :: Stored a -> Bool #

length :: Stored a -> Int #

elem :: Eq a => a -> Stored a -> Bool #

maximum :: Ord a => Stored a -> a #

minimum :: Ord a => Stored a -> a #

sum :: Num a => Stored a -> a #

product :: Num a => Stored a -> a #

Traversable Stored Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

traverse :: Applicative f => (a -> f b) -> Stored a -> f (Stored b) #

sequenceA :: Applicative f => Stored (f a) -> f (Stored a) #

mapM :: Monad m => (a -> m b) -> Stored a -> m (Stored b) #

sequence :: Monad m => Stored (m a) -> m (Stored a) #

Functor Stored Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

fmap :: (a -> b) -> Stored a -> Stored b #

(<$) :: a -> Stored b -> Stored a #

FromJSON a => FromJSON (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

ToJSON a => ToJSON (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Generic (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Associated Types

type Rep (Stored a) :: Type -> Type #

Methods

from :: Stored a -> Rep (Stored a) x #

to :: Rep (Stored a) x -> Stored a #

Show a => Show (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

showsPrec :: Int -> Stored a -> ShowS #

show :: Stored a -> String #

showList :: [Stored a] -> ShowS #

NFData a => NFData (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

rnf :: Stored a -> () #

Eq a => Eq (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

(==) :: Stored a -> Stored a -> Bool #

(/=) :: Stored a -> Stored a -> Bool #

Ord a => Ord (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

Methods

compare :: Stored a -> Stored a -> Ordering #

(<) :: Stored a -> Stored a -> Bool #

(<=) :: Stored a -> Stored a -> Bool #

(>) :: Stored a -> Stored a -> Bool #

(>=) :: Stored a -> Stored a -> Bool #

max :: Stored a -> Stored a -> Stored a #

min :: Stored a -> Stored a -> Stored a #

type Rep (Stored a) Source # 
Instance details

Defined in DomainDriven.Persistance.Class

type Rep (Stored a) = D1 ('MetaData "Stored" "DomainDriven.Persistance.Class" "domaindriven-core-0.5.0-7rYqBJZZqKF59TNQHBa9rT" 'False) (C1 ('MetaCons "Stored" 'PrefixI 'True) (S1 ('MetaSel ('Just "storedEvent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: (S1 ('MetaSel ('Just "storedTimestamp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "storedUUID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UUID))))

toStored :: MonadIO m => e -> m (Stored e) Source #