on dev help sign in
Added docs
9012d25iko
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+4
@@ -86,6 +86,7 @@ manipDefinition
86 -> Definition schemas schemas
86 -> Definition schemas schemas
87manipDefinition = UnsafeDefinition . (<> ";") . renderSQL
87manipDefinition = UnsafeDefinition . (<> ";") . renderSQL
88
88
89+-- | Like @PGTyped@ but also accounts for nullity.
89class PGNullityTyped schemas (nullty :: NullityType) where
90class PGNullityTyped schemas (nullty :: NullityType) where
90 pgNullityType :: ColumnTypeExpression schemas ('NoDef :=> nullty)
91 pgNullityType :: ColumnTypeExpression schemas ('NoDef :=> nullty)
91
92
@@ -95,6 +96,9 @@ instance PGTyped schemas ('Null ty) => PGNullityTyped schemas ('Null ty) where
95instance PGTyped schemas ('NotNull ty) => PGNullityTyped schemas ('NotNull ty) where
96instance PGTyped schemas ('NotNull ty) => PGNullityTyped schemas ('NotNull ty) where
96 pgNullityType = notNullable (pgtype @_ @('NotNull ty))
97 pgNullityType = notNullable (pgtype @_ @('NotNull ty))
97
98
99+-- | Allow you to specify pg column types in relation to haskell types.
100+-- | >>> hask @(Maybe String) ~ nullable text
101+-- | >>> hask @String ~ notNullable text
98hask
102hask
99 :: forall h schemas. PGNullityTyped schemas (NullPG h)
103 :: forall h schemas. PGNullityTyped schemas (NullPG h)
100 => ColumnTypeExpression schemas ('NoDef :=> NullPG h)
104 => ColumnTypeExpression schemas ('NoDef :=> NullPG h)