@@ -17,26 +17,13 @@ import Rel8.Schema.Field ( Field )
17import qualified Rel8.Schema.Kind as K
17import qualified Rel8.Schema.Kind as K
20−type Default :: Type -> Type
24−type GetNecessity :: Type -> Necessity
25−type family GetNecessity a where
26− GetNecessity (Default _) = 'Optional
27− GetNecessity _ = 'Required
30−type UnwrapDefault :: Type -> Type
31−type family UnwrapDefault a where
32− UnwrapDefault (Default a) = a
36-- | The @Column@ type family should be used to indicate which fields of your
20-- | The @Column@ type family should be used to indicate which fields of your
37-- data types are single columns in queries. This type family has special
21-- data types are single columns in queries. This type family has special
38-- support when a query is executed, allowing you to use a single data type for
22-- support when a query is executed, allowing you to use a single data type for
39-- both query data and rows decoded to Haskell.
23-- both query data and rows decoded to Haskell.
40type Column :: K.Context -> Type -> Type
24type Column :: K.Context -> Type -> Type
41−type Column context a =
25+type Column context a = Field context 'Required a
42− Field context (GetNecessity a) (UnwrapDefault a)
26+
28+type Default :: K.Context -> Type -> Type
29+type Default context a = Field context 'Optional a