Module Database.ERD.Generic

Generic operations and integrity tests to support the database code generated from ERDs

Exported Datatypes


type Key = Int

The general type of database keys.


Exported Functions


showDatabaseKey :: String -> (a -> Int) -> a -> String  Deterministic 

Shows a database key for an entity name as a string. Useful if a textual representation of a database key is necessary, e.g., as URL parameters in web pages. This textual representation should not be used to store database keys in attributes!


readDatabaseKey :: String -> (Int -> a) -> String -> Maybe a  Deterministic 

Transforms a string into a key for an entity name. Nothing is returned if the string does not represent a reasonable key.


newEntry :: Show a => (Int -> a -> Dynamic) -> (Int -> a -> b) -> a -> Transaction b  Deterministic 

Insert a new entity and assign a new key for it.


newEntryR :: (Show a, Show b) => (Int -> (a, b) -> Dynamic) -> a -> b -> Transaction ()  Deterministic 


getEntry :: (Read a, Show a) => (Int -> a -> Dynamic) -> (Int -> a -> b) -> Int -> Transaction b  Deterministic 


deleteEntryR :: (Eq a, Read a, Show a, Eq b, Read b, Show b) => (Int -> (a, b) -> Dynamic) -> a -> b -> Transaction ()  Deterministic 


existsEntryWithDBKey :: (Read a, Show a) => String -> (Int -> a -> Dynamic) -> Int -> Transaction ()  Deterministic 


requiredForeignDBKey :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> c -> Transaction ()  Deterministic 


getAllEntities :: (Read a, Show a) => (Int -> a -> Dynamic) -> (Int -> a -> b) -> Query [b]  Deterministic 


duplicateKeyTest :: (Int -> a -> Dynamic) -> Transaction ()  Deterministic 


duplicatePTest :: Eq a => [a] -> Transaction ()  Deterministic 


unique :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> c -> Transaction ()  Deterministic 


uniqueUpdate :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> Int) -> (b -> c) -> b -> Transaction ()  Deterministic 


uniqueC :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> b -> Transaction ()  Deterministic 


unique2 :: (Eq a, Eq b, Read a, Read b, Show a, Show b) => (Int -> (a, b) -> Dynamic) -> a -> b -> Transaction ()  Deterministic 


unique2C :: (Eq a, Eq b, Read a, Read b, Show a, Show b) => (Int -> (a, b) -> Dynamic) -> a -> b -> Transaction ()  Deterministic 


maxPTest :: Int -> [a] -> Transaction ()  Deterministic 


maxTest :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> Int -> c -> Transaction ()  Deterministic 


maxTestUpdate :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> Int) -> (b -> c) -> Int -> b -> Transaction ()  Deterministic 


maxTestC :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> Int -> c -> Transaction ()  Deterministic 


minTestC :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> Int -> c -> Transaction ()  Deterministic 


maxTestInsert :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> Int -> c -> Transaction ()  Deterministic 


minTestDelete :: (Read a, Show a, Eq c, Show c) => String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> (b -> c) -> Int -> c -> Transaction ()  Deterministic 


saveDBTerms :: (Read a, Show a, Show b) => String -> String -> (Int -> a -> Dynamic) -> (Int -> a -> b) -> IO ()  Deterministic 


restoreDBTerms :: (Read b, Show a) => String -> String -> (Int -> a -> Dynamic) -> (b -> Int) -> (b -> a) -> IO ()  Deterministic 


restoreDBRelTerms :: (Read b, Show a) => String -> String -> (Int -> a -> Dynamic) -> (b -> a) -> IO ()  Deterministic 


defaultString :: String -> String -> String  Deterministic