opaleye 0.9.3.1 → 0.9.3.2
raw patch · 3 files changed
+21/−11 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Opaleye.Internal.Values: nullPEType :: String -> PrimExpr
+ Opaleye.Internal.Values: valuesspecFieldType :: String -> Valuesspec (Field_ n a) (Field_ n a)
Files
- CHANGELOG.md +4/−0
- opaleye.cabal +1/−1
- src/Opaleye/Internal/Values.hs +16/−10
CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.9.3.2++* No externally visible changes+ ## 0.9.3.1 * No externally visible changes
opaleye.cabal view
@@ -1,6 +1,6 @@ name: opaleye copyright: Copyright (c) 2014-2018 Purely Agile Limited; 2019-2022 Tom Ellis-version: 0.9.3.1+version: 0.9.3.2 synopsis: An SQL-generating DSL targeting PostgreSQL description: An SQL-generating DSL targeting PostgreSQL. Allows Postgres queries to be written within Haskell in a
src/Opaleye/Internal/Values.hs view
@@ -113,22 +113,28 @@ valuesspecField :: Opaleye.SqlTypes.IsSqlType a => Valuesspec (Field_ n a) (Field_ n a)-valuesspecField = def+valuesspecField = def_+ where def_ = valuesspecFieldType (Opaleye.Internal.PGTypes.showSqlType sqlType)+ sqlType = columnProxy def_+ columnProxy :: f (Field_ n sqlType) -> Maybe sqlType+ columnProxy _ = Nothing -instance Opaleye.Internal.PGTypes.IsSqlType a- => Default Valuesspec (Field_ n a) (Field_ n a) where- def = def_+-- For rel8+valuesspecFieldType :: String -> Valuesspec (Field_ n a) (Field_ n a)+valuesspecFieldType sqlType = def_ where def_ = ValuesspecSafe (PM.PackMap (\f () -> fmap Column (f null_))) U.unpackspecField- null_ = nullPE sqlType+ null_ = nullPEType sqlType - sqlType = columnProxy def_- columnProxy :: f (Field_ n sqlType) -> Maybe sqlType- columnProxy _ = Nothing+instance Opaleye.Internal.PGTypes.IsSqlType a+ => Default Valuesspec (Field_ n a) (Field_ n a) where+ def = valuesspecField nullPE :: Opaleye.SqlTypes.IsSqlType a => proxy a -> HPQ.PrimExpr-nullPE sqlType = HPQ.CastExpr (Opaleye.Internal.PGTypes.showSqlType sqlType)- (HPQ.ConstExpr HPQ.NullLit)+nullPE sqlType = nullPEType (Opaleye.Internal.PGTypes.showSqlType sqlType)++nullPEType :: String -> HPQ.PrimExpr+nullPEType sqlType = HPQ.CastExpr sqlType (HPQ.ConstExpr HPQ.NullLit) -- Implementing this in terms of Valuesspec for convenience newtype Nullspec fields fields' = Nullspec (Valuesspec Void fields')