pg-schema 0.5.0.0 → 0.5.1.0
raw patch · 4 files changed
+19/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- pg-schema.cabal +1/−1
- src/PgSchema/Schema.hs +12/−12
- src/PgSchema/Types.hs +1/−1
- src/PgSchema/Utils/TF.hs +5/−0
pg-schema.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.12 name: pg-schema-version: 0.5.0.0+version: 0.5.1.0 category: Database author: Dmitry Olshansky maintainer: olshanskydr@gmail.com
src/PgSchema/Schema.hs view
@@ -114,27 +114,27 @@ GetRelTab '[] ('(c,d) ':ys) s = If (NnsName c == s) '(RdFrom d, RelMany) (GetRelTab '[] ys s) -type family Elem' (x :: Symbol) (xs :: [Symbol]) :: Bool where- Elem' x '[] = False- Elem' x (x ': xs) = True- Elem' x (y ': xs) = Elem' x xs- type IsMandatory fd = Not (FdNullable fd || FdHasDefault fd) type IsMandatory' sch tab fld = IsMandatory (GetFldDef sch tab fld) type family RestMandatory' sch t (rs :: [Symbol]) (fs :: [Symbol]) (res :: [Symbol]) :: [Symbol] where RestMandatory' sch t rs '[] res = res- RestMandatory' sch t rs (fld ': fs) res = RestMandatory' sch t rs fs- (If (IsMandatory' sch t fld && Not (Elem' fld rs)) (fld ': res) res)+ RestMandatory' sch t rs (fld ': fs) res =+ RestMandatory'' sch t rs fs res fld (IsMandatory' sch t fld && Not (Elem' fld rs)) +type family RestMandatory'' (sch :: k) (t :: NameNSK) (rs :: [Symbol])+ (fs :: [Symbol]) (res :: [Symbol]) (fld :: Symbol) (b :: Bool) :: [Symbol] where+ RestMandatory'' sch t rs fs res fld 'True = fld ': RestMandatory' sch t rs fs res+ RestMandatory'' sch t rs fs res fld 'False = RestMandatory' sch t rs fs res+ type RestMandatory sch t rs = RestMandatory' sch t rs (TdFlds (TTabDef sch t)) '[] -type family RestPK' sch t (rs :: [Symbol]) (fs :: [Symbol]) (res :: [Symbol]) :: [Symbol] where- RestPK' sch t rs '[] res = res- RestPK' sch t rs (fld ': fs) res =- RestPK' sch t rs fs (If (Not (Elem' fld rs)) (fld ': res) res)+type family RestPK' (rs :: [Symbol]) (fs :: [Symbol]) (res :: [Symbol]) :: [Symbol] where+ RestPK' rs '[] res = res+ RestPK' rs (fld ': fs) res =+ RestPK' rs fs (If (Not (Elem' fld rs)) (fld ': res) res) -type RestPK sch t rs = RestPK' sch t rs (TdKey (TTabDef sch t)) '[]+type RestPK sch t rs = RestPK' rs (TdKey (TTabDef sch t)) '[] simpleType :: Text -> TypDef simpleType c = TypDef c Nothing []
src/PgSchema/Types.hs view
@@ -45,7 +45,7 @@ import Data.Type.Bool (Not, type (&&), type (||)) import PgSchema.Schema import PgSchema.Utils.Internal hiding (fromText)-+import PgSchema.Utils.TF #ifdef MK_ARBITRARY import Test.QuickCheck(Arbitrary(arbitrary), arbitraryBoundedEnum)
src/PgSchema/Utils/TF.hs view
@@ -60,3 +60,8 @@ type family Map1 (f :: a ~> b) (xs :: [a]) :: [b] where Map1 f '[] = '[] Map1 f (x ': xs) = Apply f x ': Map1 f xs++type family Elem' (x :: Symbol) (xs :: [Symbol]) :: Bool where+ Elem' x '[] = False+ Elem' x (x ': xs) = True+ Elem' x (y ': xs) = Elem' x xs