HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulepersistent-2.18.1.0Haskell2010

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.

Contents
  1. The EntityDef type
  2. Construction
  3. Accessors
  4. Setters
  5. Related Types
Synopsis

The EntityDef type

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.18.1.0 · Database.Persist.Types.Base
  • Ord EntityDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Read EntityDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Show EntityDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Lift EntityDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base

Construction

Accessors

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.

Gets the Source of the definition of the entity.

Note that as of this writing the span covers the entire file or quasiquote where the item is defined due to parsing limitations. This may be changed in a future release to be more accurate.

Setters

Related Types

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.18.1.0 · Database.Persist.Types.Base
  • Ord EntityIdDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Read EntityIdDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Show EntityIdDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base
  • Lift EntityIdDefDefined in persistent-2.18.1.0 · Database.Persist.Types.Base