-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type-safe, non-relational, multi-backend persistence. -- -- This library provides just the general interface and helper functions. -- You must use a specific backend in order to make this useful. @package persistent-template @version 1.0.0.2 -- | This module provides utilities for creating backends. Regular users do -- not need to use this module. module Database.Persist.TH -- | Converts a quasi-quoted syntax into a list of entity definitions, to -- be used as input to the template haskell generation code (mkPersist). persistWith :: PersistSettings -> QuasiQuoter -- | Apply persistWith to upperCaseSettings. persistUpperCase :: QuasiQuoter -- | Apply persistWith to lowerCaseSettings. persistLowerCase :: QuasiQuoter -- | Same as persistWith, but uses an external file instead of a -- quasiquotation. persistFileWith :: PersistSettings -> FilePath -> Q Exp -- | Deprecate synonym for persistUpperCase. -- | Deprecated: Please use persistUpperCase instead. persist :: QuasiQuoter -- | Deprecated function. Equivalent to persistFileWith -- upperCaseSettings. persistFile :: FilePath -> Q Exp -- | Create data types and appropriate PersistEntity instances for -- the given EntityDefs. Works well with the persist quasi-quoter. mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec] -- | Settings to be passed to the mkPersist function. data MkPersistSettings MkPersistSettings :: Type -> MkPersistSettings -- | Which database backend we're using. -- -- When generating data types, each type is given a generic version- -- which works with any backend- and a type synonym for the commonly used -- backend. This is where you specify that commonly used backend. mpsBackend :: MkPersistSettings -> Type -- | Use the SqlPersist backend. sqlSettings :: MkPersistSettings -- | 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. mkMigrate :: String -> [EntityDef] -> Q [Dec] -- | Save the EntityDefs passed in under the given name. mkSave :: String -> [EntityDef] -> Q [Dec] -- | Generate a DeleteCascade instance for the given -- EntityDefs. mkDeleteCascade :: [EntityDef] -> Q [Dec] -- | Apply the given list of functions to the same EntityDefs. -- -- This function is useful for cases such as: -- --
--   >>> share [mkSave "myDefs", mkPersist sqlSettings] [persistLowerCase|...|]
--   
share :: [[EntityDef] -> Q [Dec]] -> [EntityDef] -> Q [Dec] -- | Automatically creates a valid PersistField instance for any -- datatype that has valid Show and Read instances. Can be -- very convenient for Enum types. derivePersistField :: String -> Q [Dec] -- | produce code similar to the following: -- -- instance PersistEntity e => PersistField e where toPersistValue = -- PersistMap $ zip columNames (map toPersistValue . toPersistFields) -- fromPersistValue (PersistMap o) = fromPersistValues $ map ((_,v) -> -- casefromPersistValue v of Left e -> error e Right r -> r) o -- fromPersistValue x = Left $ Expected PersistMap, received: ++ -- show x sqlType _ = SqlString persistFieldFromEntity :: EntityDef -> Q [Dec] -- | Deprecated, restricted version of share. -- | Deprecated: Use share instead share2 :: ([EntityDef] -> Q [Dec]) -> ([EntityDef] -> Q [Dec]) -> [EntityDef] -> Q [Dec] instance Lift PersistUpdate instance Lift PersistFilter instance Lift FieldType instance Lift DBName instance Lift HaskellName instance Lift UniqueDef instance Lift FieldDef instance Lift EntityDef