module Database.Persist.FieldDef
(
FieldDef
, setFieldAttrs
, overFieldAttrs
, addFieldAttr
, isFieldNotGenerated
, isHaskellField
, FieldCascade(..)
, renderFieldCascade
, renderCascadeAction
, noCascade
, CascadeAction(..)
) where
import Database.Persist.FieldDef.Internal
import Database.Persist.Types.Base
( isHaskellField
, FieldAttr
)
setFieldAttrs :: [FieldAttr] -> FieldDef -> FieldDef
setFieldAttrs :: [FieldAttr] -> FieldDef -> FieldDef
setFieldAttrs [FieldAttr]
fas FieldDef
fd = FieldDef
fd { fieldAttrs :: [FieldAttr]
fieldAttrs = [FieldAttr]
fas }
overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef
overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef
overFieldAttrs [FieldAttr] -> [FieldAttr]
k FieldDef
fd = FieldDef
fd { fieldAttrs :: [FieldAttr]
fieldAttrs = [FieldAttr] -> [FieldAttr]
k (FieldDef -> [FieldAttr]
fieldAttrs FieldDef
fd) }
addFieldAttr :: FieldAttr -> FieldDef -> FieldDef
addFieldAttr :: FieldAttr -> FieldDef -> FieldDef
addFieldAttr FieldAttr
fa = ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef
overFieldAttrs (FieldAttr
fa FieldAttr -> [FieldAttr] -> [FieldAttr]
forall a. a -> [a] -> [a]
:)