mealstrom-0.0.1.1: Manipulate FSMs and store them in PostgreSQL.
Copyright(c) Max Amanshauser 2016
LicenseMIT
Maintainermax@lambdalifting.org
Safe HaskellNone
LanguageHaskell2010

Mealstrom.PostgresJSONStore

Description

This module is the main backend for FSMs. Instances are stored in a table with the name passed as storeName when creating the PostgresJSONStore. WALs use the same name with Wal appended.

Synopsis

Documentation

mkStore :: String -> Text -> IO PostgresJSONStore Source #

Creates a postgresql store

_fsmRead :: (FromJSON s, FromJSON e, FromJSON a, Typeable s, Typeable e, Typeable a, MealyInstance k s e a) => PostgresJSONStore -> k -> Proxy k s e a -> IO (Maybe (Instance k s e a)) Source #

_fsmCreate :: forall k s e a. (ToJSON s, ToJSON e, ToJSON a, Typeable s, Typeable e, Typeable a, MealyInstance k s e a) => PostgresJSONStore -> Instance k s e a -> IO (Maybe String) Source #

_batchConversion :: forall k s e a. (FromJSON s, FromJSON e, FromJSON a, ToJSON s, ToJSON e, ToJSON a, Typeable s, Typeable e, Typeable a, MealyInstance k s e a) => PostgresJSONStore -> Text -> Proxy k s e a -> IO () Source #

You can call this function when you changed the representation of your MealyMachine. It will read all instances through FromJSON and write them back using ToJSON.

Orphan instances

FSMKey k => FromField k Source # 
Instance details

Methods

fromField :: FieldParser k #

FSMKey k => ToField k Source # 
Instance details

Methods

toField :: k -> Action #

FSMKey k => Generic (WALEntry k) Source # 
Instance details

Associated Types

type Rep (WALEntry k) :: Type -> Type #

Methods

from :: WALEntry k -> Rep (WALEntry k) x #

to :: Rep (WALEntry k) x -> WALEntry k #

ToJSON e => ToJSON (Msg e) Source # 
Instance details

Methods

toJSON :: Msg e -> Value #

toEncoding :: Msg e -> Encoding #

toJSONList :: [Msg e] -> Value #

toEncodingList :: [Msg e] -> Encoding #

FromJSON e => FromJSON (Msg e) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Msg e) #

parseJSONList :: Value -> Parser [Msg e] #

FSMKey k => FromRow (WALEntry k) Source # 
Instance details

Methods

fromRow :: RowParser (WALEntry k) #

(ToJSON s, ToJSON e, ToJSON a) => ToJSON (Machine s e a) Source #

Instance to convert one DB row to an instance of Instance ;) users of this module must provide instances for ToJSON, FromJSON for s, e and a.

Instance details

Methods

toJSON :: Machine s e a -> Value #

toEncoding :: Machine s e a -> Encoding #

toJSONList :: [Machine s e a] -> Value #

toEncodingList :: [Machine s e a] -> Encoding #

(FromJSON s, FromJSON e, FromJSON a) => FromJSON (Machine s e a) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Machine s e a) #

parseJSONList :: Value -> Parser [Machine s e a] #

(Typeable s, Typeable e, Typeable a, FromJSON s, FromJSON e, FromJSON a) => FromField (Machine s e a) Source # 
Instance details

Methods

fromField :: FieldParser (Machine s e a) #

(Typeable s, Typeable e, Typeable a, ToJSON s, ToJSON e, ToJSON a) => ToField (Machine s e a) Source # 
Instance details

Methods

toField :: Machine s e a -> Action #

(Typeable s, Typeable e, Typeable a, FromJSON s, FromJSON e, FromJSON a, FSMKey k) => FromRow (Instance k s e a) Source # 
Instance details

Methods

fromRow :: RowParser (Instance k s e a) #