persistent-2.13.1.1: Type-safe, multi-backend data serialization.
Safe HaskellNone
LanguageHaskell2010

Database.Persist.FieldDef.Internal

Description

Since: 2.13.0.0

Synopsis

Documentation

data FieldDef Source #

A FieldDef represents the inormation that persistent knows about a field of a datatype. This includes information used to parse the field out of the database and what the field corresponds to.

Constructors

FieldDef 

Fields

  • fieldHaskell :: !FieldNameHS

    The name of the field. Note that this does not corresponds to the record labels generated for the particular entity - record labels are generated with the type name prefixed to the field, so a FieldDef that contains a FieldNameHS "name" for a type User will have a record field userName.

  • fieldDB :: !FieldNameDB

    The name of the field in the database. For SQL databases, this corresponds to the column name.

  • fieldType :: !FieldType

    The type of the field in Haskell.

  • fieldSqlType :: !SqlType

    The type of the field in a SQL database.

  • fieldAttrs :: ![FieldAttr]

    User annotations for a field. These are provided with the ! operator.

  • fieldStrict :: !Bool

    If this is True, then the Haskell datatype will have a strict record field. The default value for this is True.

  • fieldReference :: !ReferenceDef
     
  • fieldCascade :: !FieldCascade

    Defines how operations on the field cascade on to the referenced tables. This doesn't have any meaning if the fieldReference is set to NoReference or SelfReference. The cascade option here should be the same as the one obtained in the fieldReference.

    Since: 2.11.0

  • fieldComments :: !(Maybe Text)

    Optional comments for a Field. There is not currently a way to attach comments to a field in the quasiquoter.

    Since: 2.10.0

  • fieldGenerated :: !(Maybe Text)

    Whether or not the field is a GENERATED column, and additionally the expression to use for generation.

    Since: 2.11.0.0

  • fieldIsImplicitIdColumn :: !Bool

    True if the field is an implicit ID column. False otherwise.

    Since: 2.13.0.0

Instances

Instances details
Eq FieldDef Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

(==) :: FieldDef -> FieldDef -> Bool

(/=) :: FieldDef -> FieldDef -> Bool

Ord FieldDef Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

compare :: FieldDef -> FieldDef -> Ordering

(<) :: FieldDef -> FieldDef -> Bool

(<=) :: FieldDef -> FieldDef -> Bool

(>) :: FieldDef -> FieldDef -> Bool

(>=) :: FieldDef -> FieldDef -> Bool

max :: FieldDef -> FieldDef -> FieldDef

min :: FieldDef -> FieldDef -> FieldDef

Read FieldDef Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

readsPrec :: Int -> ReadS FieldDef

readList :: ReadS [FieldDef]

readPrec :: ReadPrec FieldDef

readListPrec :: ReadPrec [FieldDef]

Show FieldDef Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

showsPrec :: Int -> FieldDef -> ShowS

show :: FieldDef -> String

showList :: [FieldDef] -> ShowS

Lift FieldDef Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

lift :: FieldDef -> Q Exp

liftTyped :: FieldDef -> Q (TExp FieldDef)

data FieldCascade Source #

This datatype describes how a foreign reference field cascades deletes or updates.

This type is used in both parsing the model definitions and performing migrations. A Nothing in either of the field values means that the user has not specified a CascadeAction. An unspecified CascadeAction is defaulted to Restrict when doing migrations.

Since: 2.11.0

Constructors

FieldCascade 

Fields

Instances

Instances details
Eq FieldCascade Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

(==) :: FieldCascade -> FieldCascade -> Bool

(/=) :: FieldCascade -> FieldCascade -> Bool

Ord FieldCascade Source # 
Instance details

Defined in Database.Persist.Types.Base

Read FieldCascade Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

readsPrec :: Int -> ReadS FieldCascade

readList :: ReadS [FieldCascade]

readPrec :: ReadPrec FieldCascade

readListPrec :: ReadPrec [FieldCascade]

Show FieldCascade Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

showsPrec :: Int -> FieldCascade -> ShowS

show :: FieldCascade -> String

showList :: [FieldCascade] -> ShowS

Lift FieldCascade Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

lift :: FieldCascade -> Q Exp

liftTyped :: FieldCascade -> Q (TExp FieldCascade)

renderFieldCascade :: FieldCascade -> Text Source #

Renders a FieldCascade value such that it can be used in SQL migrations.

Since: 2.11.0

renderCascadeAction :: CascadeAction -> Text Source #

Render a CascadeAction to Text such that it can be used in a SQL command.

Since: 2.11.0

noCascade :: FieldCascade Source #

A FieldCascade that does nothing.

Since: 2.11.0

data CascadeAction Source #

An action that might happen on a deletion or update on a foreign key change.

Since: 2.11.0

Instances

Instances details
Eq CascadeAction Source # 
Instance details

Defined in Database.Persist.Types.Base

Ord CascadeAction Source # 
Instance details

Defined in Database.Persist.Types.Base

Read CascadeAction Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

readsPrec :: Int -> ReadS CascadeAction

readList :: ReadS [CascadeAction]

readPrec :: ReadPrec CascadeAction

readListPrec :: ReadPrec [CascadeAction]

Show CascadeAction Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

showsPrec :: Int -> CascadeAction -> ShowS

show :: CascadeAction -> String

showList :: [CascadeAction] -> ShowS

Lift CascadeAction Source # 
Instance details

Defined in Database.Persist.Types.Base

Methods

lift :: CascadeAction -> Q Exp

liftTyped :: CascadeAction -> Q (TExp CascadeAction)