This module provides utilities for creating backends. Regular users do not need to use this module.
- recName :: String -> String -> String
- upperFirst :: String -> String
- data EntityDef = EntityDef {
- entityName :: String
- entityColumns :: [(String, String, [String])]
- entityUniques :: [(String, [String])]
- entityDerives :: [String]
- entityOrders :: EntityDef -> [(String, String)]
- entityFilters :: EntityDef -> [(String, String, Bool, PersistFilter)]
- entityUpdates :: EntityDef -> [(String, String, Bool)]
- dataTypeDec :: EntityDef -> Dec
- persistMonadTypeDec :: Type -> EntityDef -> Dec
- keyTypeDec :: String -> String -> EntityDef -> Dec
- filterTypeDec :: EntityDef -> Dec
- updateTypeDec :: EntityDef -> Dec
- orderTypeDec :: EntityDef -> Dec
- uniqueTypeDec :: EntityDef -> Dec
- mkToPersistFields :: Type -> [(String, Int)] -> Q Dec
- mkToFieldNames :: Type -> [(String, [String])] -> Dec
- mkToFieldName :: Type -> [(String, String)] -> Dec
- mkPersistField :: Type -> [String] -> Dec
- mkToFilter :: Type -> [(String, PersistFilter, Bool)] -> Dec
- mkToOrder :: Type -> [(String, String)] -> Dec
- mkHalfDefined :: Type -> String -> Int -> Dec
- data SomePersistField = forall a . PersistField a => SomePersistField a
- class ToPersistFields a where
- toPersistFields :: a -> [SomePersistField]
- class FromPersistValues a where
- fromPersistValues :: [PersistValue] -> Either String a
- toPersistValues :: ToPersistFields a => a -> [PersistValue]
- class ToFieldNames a where
- toFieldNames :: a -> [String]
- class ToOrder a where
- toOrder :: a -> PersistOrder
- data PersistOrder
- class ToFieldName a where
- toFieldName :: a -> String
- data PersistFilter
- class ToFilter a where
- toFilter :: a -> PersistFilter
- isNull :: a -> Bool
- class HalfDefined a where
- halfDefined :: a
- apE :: Either x (y -> z) -> Either x y -> Either x z
- addIsNullable :: EntityDef -> (String, (String, String)) -> (String, (String, Bool))
Documentation
upperFirst :: String -> StringSource
High level design
EntityDef | |
|
entityOrders :: EntityDef -> [(String, String)]Source
entityFilters :: EntityDef -> [(String, String, Bool, PersistFilter)]Source
TH datatype helpers
dataTypeDec :: EntityDef -> DecSource
persistMonadTypeDec :: Type -> EntityDef -> DecSource
filterTypeDec :: EntityDef -> DecSource
updateTypeDec :: EntityDef -> DecSource
orderTypeDec :: EntityDef -> DecSource
uniqueTypeDec :: EntityDef -> DecSource
TH typeclass helpers
mkPersistField :: Type -> [String] -> DecSource
mkToFilter :: Type -> [(String, PersistFilter, Bool)] -> DecSource
Type classes
data SomePersistField Source
forall a . PersistField a => SomePersistField a |
class ToPersistFields a whereSource
toPersistFields :: a -> [SomePersistField]Source
class FromPersistValues a whereSource
fromPersistValues :: [PersistValue] -> Either String aSource
toPersistValues :: ToPersistFields a => a -> [PersistValue]Source
class ToFieldNames a whereSource
toFieldNames :: a -> [String]Source
toOrder :: a -> PersistOrderSource
data PersistOrder Source
class ToFieldName a whereSource
toFieldName :: a -> StringSource
class HalfDefined a whereSource
halfDefined :: aSource