persistent-template-0.6.3: Type-safe, non-relational, multi-backend persistence.



This module provides utilities for creating backends. Regular users do not need to use this module.



mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]Source

Create data types and appropriate PersistEntity instances for the given EntityDefs. Works well with the persist quasi-quoter.

share :: [[EntityDef] -> Q [Dec]] -> [EntityDef] -> Q [Dec]Source

persist :: QuasiQuoterSource

Converts a quasi-quoted syntax into a list of entity definitions, to be used as input to the template haskell generation code (mkPersist).

share2 :: ([EntityDef] -> Q [Dec]) -> ([EntityDef] -> Q [Dec]) -> [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.