Database.Persist.TH
Description
This module provides utilities for creating backends. Regular users do not need to use this module.
- mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]
- share :: [[EntityDef] -> Q [Dec]] -> [EntityDef] -> Q [Dec]
- persist :: QuasiQuoter
- persistFile :: FilePath -> Q Exp
- share2 :: ([EntityDef] -> Q [Dec]) -> ([EntityDef] -> Q [Dec]) -> [EntityDef] -> Q [Dec]
- mkSave :: String -> [EntityDef] -> Q [Dec]
- mkDeleteCascade :: [EntityDef] -> Q [Dec]
- derivePersistField :: String -> Q [Dec]
- mkMigrate :: String -> [EntityDef] -> Q [Dec]
- data MkPersistSettings = MkPersistSettings {
- mpsBackend :: Type
- sqlSettings :: MkPersistSettings
Documentation
mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]Source
Create data types and appropriate PersistEntity
instances for the given
EntityDef
s. Works well with the persist quasi-quoter.
Converts a quasi-quoted syntax into a list of entity definitions, to be used as input to the template haskell generation code (mkPersist).
persistFile :: FilePath -> Q ExpSource
mkDeleteCascade :: [EntityDef] -> Q [Dec]Source
derivePersistField :: String -> Q [Dec]Source
Automatically creates a valid PersistField
instance for any datatype
that has valid Show
and Read
instances. Can be very convenient for
Enum
types.
mkMigrate :: String -> [EntityDef] -> Q [Dec]Source
Creates a single function to perform all migrations for the entities defined here. One thing to be aware of is dependencies: if you have entities with foreign references, make sure to place those definitions after the entities they reference.
data MkPersistSettings Source
Constructors
MkPersistSettings | |
Fields
|