Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.Persist.FieldDef
Description
Since: 2.13.0.0
Synopsis
- data FieldDef
- setFieldAttrs :: [FieldAttr] -> FieldDef -> FieldDef
- overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef
- addFieldAttr :: FieldAttr -> FieldDef -> FieldDef
- isFieldNullable :: FieldDef -> IsNullable
- isFieldMaybe :: FieldDef -> Bool
- isFieldNotGenerated :: FieldDef -> Bool
- isHaskellField :: FieldDef -> Bool
- data FieldCascade = FieldCascade {
- fcOnUpdate :: !(Maybe CascadeAction)
- fcOnDelete :: !(Maybe CascadeAction)
- renderFieldCascade :: FieldCascade -> Text
- renderCascadeAction :: CascadeAction -> Text
- noCascade :: FieldCascade
- data CascadeAction
- = Cascade
- | Restrict
- | SetNull
- | SetDefault
The FieldDef
type
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.
Setters
overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef Source #
Modify the list of field attributes.
Since: 2.13.0.0
addFieldAttr :: FieldAttr -> FieldDef -> FieldDef Source #
Add an attribute to the list of field attributes.
Since: 2.13.0.0
Helpers
isFieldNullable :: FieldDef -> IsNullable Source #
Check if the field definition is nullable
Since: 2.13.0.0
isFieldMaybe :: FieldDef -> Bool Source #
Check if the field is `Maybe a`
Since: 2.13.0.0
isFieldNotGenerated :: FieldDef -> Bool Source #
isHaskellField :: FieldDef -> Bool Source #
FieldCascade
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
Eq FieldCascade Source # | |
Defined in Database.Persist.Types.Base | |
Ord FieldCascade Source # | |
Defined in Database.Persist.Types.Base Methods compare :: FieldCascade -> FieldCascade -> Ordering # (<) :: FieldCascade -> FieldCascade -> Bool # (<=) :: FieldCascade -> FieldCascade -> Bool # (>) :: FieldCascade -> FieldCascade -> Bool # (>=) :: FieldCascade -> FieldCascade -> Bool # max :: FieldCascade -> FieldCascade -> FieldCascade # min :: FieldCascade -> FieldCascade -> FieldCascade # | |
Read FieldCascade Source # | |
Defined in Database.Persist.Types.Base Methods readsPrec :: Int -> ReadS FieldCascade # readList :: ReadS [FieldCascade] # | |
Show FieldCascade Source # | |
Defined in Database.Persist.Types.Base Methods showsPrec :: Int -> FieldCascade -> ShowS # show :: FieldCascade -> String # showList :: [FieldCascade] -> ShowS # | |
Lift FieldCascade Source # | |
Defined in Database.Persist.Types.Base |
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
Constructors
Cascade | |
Restrict | |
SetNull | |
SetDefault |