HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepersistent-2.14.6.3Haskell2010

Database.Persist.EntityDef

An EntityDef represents metadata about a type that persistent uses to store the type in the database, as well as generate Haskell code from it.

  • 2 types
  • 20 values

The EntityDef type

1 declaration
datadata EntityDef
#

An EntityDef represents the information that persistent knows about an Entity. It uses this information to generate the Haskell datatype, the SQL migrations, and other relevant conversions.

Instances5Eq, Ord, Read, Show, Lift
  • Eq EntityDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Ord EntityDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Read EntityDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Show EntityDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Lift EntityDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base

Construction

0 declarations

Accessors

16 declarations

Retrieve the list of FieldDef that makes up the fields of the entity.

This does not return the fields for an Id column or an implicit id. It will return the key columns if you used the Primary syntax for defining the primary key.

This does not return fields that are marked SafeToRemove or MigrationOnly - so it only returns fields that are represented in the Haskell type. If you need those fields, use getEntityFieldsDatabase.

This returns all of the FieldDef defined for the EntityDef, including those fields that are marked as MigrationOnly (and therefore only present in the database) or SafeToRemove (and a migration will drop the column if it exists in the database).

For all the fields that are present on the Haskell-type, see getEntityFields.

Setters

4 declarations

Related Types

1 declaration
datadata EntityIdDef
#

The definition for the entity's primary key ID.

Constructors

  • EntityIdField !FieldDef

    The entity has a single key column, and it is a surrogate key - that is, you can't go from rec -> Key rec.

  • EntityIdNaturalKey !CompositeDef

    The entity has a natural key. This means you can write rec -> Key rec because all the key fields are present on the datatype.

    A natural key can have one or more columns.

Instances5Eq, Ord, Read, Show, Lift
  • Eq EntityIdDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Ord EntityIdDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Read EntityIdDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Show EntityIdDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base
  • Lift EntityIdDefDefined in persistent-2.14.6.3 · Database.Persist.Types.Base