persistent-1.1.5.1: Type-safe, multi-backend data serialization.

Safe Haskell | None

Database.Persist.EntityDef

Contents

- Helper types
- Defs
- Utils

Synopsis

- newtype HaskellName = HaskellName {
  - unHaskellName :: Text
  }
- newtype DBName = DBName {
  - unDBName :: Text
  }
- type Attr = Text
- data EntityDef = EntityDef {
  - entityHaskell :: HaskellName
  - entityDB :: DBName
  - entityID :: DBName
  - entityAttrs :: [Attr]
  - entityFields :: [FieldDef]
  - entityUniques :: [UniqueDef]
  - entityDerives :: [Text]
  - entityExtra :: Map Text [ExtraLine]
  - entitySum :: Bool
  }
- data FieldDef = FieldDef {
  - fieldHaskell :: HaskellName
  - fieldDB :: DBName
  - fieldType :: FieldType
  - fieldAttrs :: [Attr]
  }
- data FieldType
  - = FTTypeCon (Maybe Text) Text
  - | FTApp FieldType FieldType
  - | FTList FieldType
- data UniqueDef = UniqueDef {
  - uniqueHaskell :: HaskellName
  - uniqueDBName :: DBName
  - uniqueFields :: [(HaskellName, DBName)]
  - uniqueAttrs :: [Attr]
  }
- type ExtraLine = [Text]
- stripId :: FieldType -> Maybe Text

# Helper types

newtype HaskellName

Constructors

HaskellName |

Fields

unHaskellName :: Text

Instances

Eq HaskellName |
Ord HaskellName |
Read HaskellName |
Show HaskellName |

newtype DBName

Constructors

DBName |

Fields

unDBName :: Text

Instances

Eq DBName |
Ord DBName |
Read DBName |
Show DBName |

type Attr = Text

# Defs

data EntityDef

Constructors

EntityDef |

Fields

entityHaskell :: HaskellName
entityDB :: DBName
entityID :: DBName
entityAttrs :: [Attr]
entityFields :: [FieldDef]
entityUniques :: [UniqueDef]
entityDerives :: [Text]
entityExtra :: Map Text [ExtraLine]
entitySum :: Bool

Instances

Eq EntityDef |
Ord EntityDef |
Read EntityDef |
Show EntityDef |

data FieldDef

Constructors

FieldDef |

Fields

fieldHaskell :: HaskellName
fieldDB :: DBName
fieldType :: FieldType
fieldAttrs :: [Attr]

Instances

Eq FieldDef |
Ord FieldDef |
Read FieldDef |
Show FieldDef |

data FieldType

Constructors

FTTypeCon (Maybe Text) Text | optional module, name
FTApp FieldType FieldType |
FTList FieldType |

Instances

Eq FieldType |
Ord FieldType |
Read FieldType |
Show FieldType |

data UniqueDef

Constructors

UniqueDef |

Fields

uniqueHaskell :: HaskellName
uniqueDBName :: DBName
uniqueFields :: [(HaskellName, DBName)]
uniqueAttrs :: [Attr]

Instances

Eq UniqueDef |
Ord UniqueDef |
Read UniqueDef |
Show UniqueDef |

type ExtraLine = [Text]

# Utils

stripId :: FieldType -> Maybe Text