Copyright | (c) Max Amanshauser 2016 |
---|---|
License | MIT |
Maintainer | max@lambdalifting.org |
Safe Haskell | None |
Language | Haskell2010 |
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
- data PostgresJSONStore
- mkStore :: String -> Text -> IO PostgresJSONStore
- _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))
- _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)
- _fsmUpdate :: 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 -> k -> MachineTransformer s e a -> IO MealyStatus
- _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 ()
Documentation
data PostgresJSONStore Source #
Instances
FSMKey k => WALStore PostgresJSONStore k Source # | |
Defined in Mealstrom.PostgresJSONStore walUpsertIncrement :: PostgresJSONStore -> k -> IO () Source # walDecrement :: PostgresJSONStore -> k -> IO () Source # walScan :: PostgresJSONStore -> Int -> IO [WALEntry k] Source # | |
(FromJSON s, FromJSON e, FromJSON a, ToJSON s, ToJSON e, ToJSON a, Typeable s, Typeable e, Typeable a, MealyInstance k s e a) => FSMStore PostgresJSONStore k s e a Source # | |
Defined in Mealstrom.PostgresJSONStore fsmRead :: PostgresJSONStore -> k -> Proxy k s e a -> IO (Maybe s) Source # fsmCreate :: PostgresJSONStore -> Instance k s e a -> IO (Maybe String) Source # fsmUpdate :: PostgresJSONStore -> k -> MachineTransformer s e a -> IO MealyStatus Source # |
_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 #
_fsmUpdate :: 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 -> k -> MachineTransformer s e a -> IO MealyStatus 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 # | |
fromField :: FieldParser k # | |
FSMKey k => ToField k Source # | |
FSMKey k => Generic (WALEntry k) Source # | |
ToJSON e => ToJSON (Msg e) Source # | |
FromJSON e => FromJSON (Msg e) Source # | |
FSMKey k => FromRow (WALEntry k) Source # | |
(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 |
(FromJSON s, FromJSON e, FromJSON a) => FromJSON (Machine s e a) Source # | |
(Typeable s, Typeable e, Typeable a, FromJSON s, FromJSON e, FromJSON a) => FromField (Machine s e a) Source # | |
fromField :: FieldParser (Machine s e a) # | |
(Typeable s, Typeable e, Typeable a, ToJSON s, ToJSON e, ToJSON a) => ToField (Machine s e a) Source # | |
(Typeable s, Typeable e, Typeable a, FromJSON s, FromJSON e, FromJSON a, FSMKey k) => FromRow (Instance k s e a) Source # | |