-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Calculate db-data dependencies of functions -- -- Rerun computations that depend on SQL-select statements @package SQLDeps @version 0.1 -- | Simple type definitions for SQLDeps module Database.SQLDeps.Types type FieldName = (TableName, String) type TableName = String data FieldVal IntVal :: Int -> FieldVal StrVal :: String -> FieldVal data Select Select :: [FieldName] -> [TableName] -> [Filter] -> Select data Upsert Update :: TableName -> [(FieldName, FieldVal)] -> [Filter] -> Upsert Insert :: TableName -> [(FieldName, FieldVal)] -> Upsert data Filter LargerThan :: FieldName -> FieldVal -> Filter SmallerThan :: FieldName -> FieldVal -> Filter EqualTo :: FieldName -> FieldVal -> Filter instance Eq FieldVal instance Ord FieldVal instance Generic FieldVal instance Show FieldVal instance Eq Filter instance Ord Filter instance Generic Filter instance Show Filter instance Eq Upsert instance Ord Upsert instance Generic Upsert instance Show Upsert instance Eq Select instance Ord Select instance Generic Select instance Show Select instance Datatype D1FieldVal instance Constructor C1_0FieldVal instance Constructor C1_1FieldVal instance Datatype D1Filter instance Constructor C1_0Filter instance Constructor C1_1Filter instance Constructor C1_2Filter instance Datatype D1Upsert instance Constructor C1_0Upsert instance Constructor C1_1Upsert instance Datatype D1Select instance Constructor C1_0Select instance Hashable Filter instance Hashable Upsert instance Hashable FieldVal instance Hashable Select -- | Helper module that calcuates which SELECT statements are affected by -- an UPDATE or INSERT module Database.SQLDeps.Diff affectedSelects :: Upsert -> [Select] -> [Select] -- | Helper module to generate prepared statements from SQLDeps.Types types module Database.SQLDeps.QueryWriter fName :: FieldName -> String fFilter :: Filter -> String vVal :: FieldVal -> SqlValue vFilter :: Filter -> SqlValue class QueryWriter a preparedStmt :: QueryWriter a => a -> (String, [SqlValue]) instance QueryWriter Select instance QueryWriter Upsert -- | The core engine for keeping track of computations and their -- dependencies. Check the Example.hs for an example use. module Database.SQLDeps.Engine -- | Start the frameworks engine with a given HDBC-Connection runEngine :: IConnection conn => conn -> DepsM conn a -> IO a -- | Run an update/insert query on the database. All depending computations -- will be run after the update/insert is commited. change :: IConnection conn => Upsert -> DepsM conn () -- | Run a query and register it's parent computation. Important: Keep the -- CompId unique for every unique computation, otherwise you will run -- into errors query :: IConnection conn => Select -> CompId -> (DepsM conn ()) -> DepsM conn ([[SqlValue]]) -- | Unique identifier given by the user to a computation type CompId = String -- | The engines monad, keeping track of queries, dependencies, -- computations and the connection type DepsM conn a = RWST conn () (QueryCollection conn) IO a -- | Reexport public modules module Database.SQLDeps