on dev help sign in
docs
02bbfc6Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+9
@@ -982,6 +982,15 @@ createTypeCompositeFrom ty = createTypeComposite ty
982 :: NP (Aliased (TypeExpression schemas)) (RowPG hask))
982 :: NP (Aliased (TypeExpression schemas)) (RowPG hask))
983
983
984{-|
984{-|
985+`createDomain` creates a new domain. A domain is essentially a data type
986+with constraints (restrictions on the allowed set of values).
987+
988+Domains are useful for abstracting common constraints on fields
989+into a single location for maintenance. For example, several tables might
990+contain email address columns, all requiring the same `check` constraint
991+to verify the address syntax. Define a domain rather than setting up
992+each table's constraint individually.
993+
985>>> :{
994>>> :{
986let
995let
987 createPositive :: Definition (Public '[]) (Public '["positive" ::: 'Typedef 'PGfloat4])
996 createPositive :: Definition (Public '[]) (Public '["positive" ::: 'Typedef 'PGfloat4])