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

Database.Persist.FieldDef

Description

Since: 2.13.0.0

Synopsis

The FieldDef type

data FieldDef #

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.

Instances

Instances details
Read FieldDef # 
Instance details

Defined in Database.Persist.Types.Base

Show FieldDef # 
Instance details

Defined in Database.Persist.Types.Base

Eq FieldDef # 
Instance details

Defined in Database.Persist.Types.Base

Ord FieldDef # 
Instance details

Defined in Database.Persist.Types.Base

Lift FieldDef # 
Instance details

Defined in Database.Persist.Types.Base

Methods

lift :: Quote m => FieldDef -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => FieldDef -> Code m FieldDef #

Setters

setFieldAttrs :: [FieldAttr] -> FieldDef -> FieldDef #

Replace the FieldDef FieldAttr with the new list.

Since: 2.13.0.0

overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef #

Modify the list of field attributes.

Since: 2.13.0.0

addFieldAttr :: FieldAttr -> FieldDef -> FieldDef #

Add an attribute to the list of field attributes.

Since: 2.13.0.0

Helpers

isFieldNullable :: FieldDef -> IsNullable #

Check if the field definition is nullable

Since: 2.13.0.0

isFieldMaybe :: FieldDef -> Bool #

Check if the field is `Maybe a`

Since: 2.13.0.0

isHaskellField :: FieldDef -> Bool #

Returns True if the FieldDef does not have a MigrationOnly or SafeToRemove flag from the QuasiQuoter.

Since: 2.13.0.0

FieldCascade

data FieldCascade #

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

renderFieldCascade :: FieldCascade -> Text #

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

Since: 2.11.0

renderCascadeAction :: CascadeAction -> Text #

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

Since: 2.11.0

noCascade :: FieldCascade #

A FieldCascade that does nothing.

Since: 2.11.0