packages feed

hasql-interpolate 0.2.0.0 → 0.2.1.0

raw patch · 4 files changed

+18/−4 lines, 4 filesdep ~basedep ~bytestringdep ~containersPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, bytestring, containers, megaparsec, template-haskell, text, time

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.2.1.0 -- 2023-08-29++* Fix encoder generation bug (https://github.com/awkward-squad/hasql-interpolate/pull/10)+ ## 0.2.0.0 -- 2023-08-17  * Relax context of tuple instances for `EncodeRow` from `EncodeValue` to `EncodeField` (https://github.com/awkward-squad/hasql-interpolate/pull/9)
hasql-interpolate.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               hasql-interpolate-version:            0.2.0.0+version:            0.2.1.0  author: Travis Staton <hello@travisstaton.com> category: Hasql, Database, PostgreSQL
lib/Hasql/Interpolate/Internal/TH.hs view
@@ -319,9 +319,9 @@      in foldr go [e|pure mempty|] sqlBuilder   encExp <-     let go a b = case a of-          Pe'Exp x -> [e|$(pure x) >$ E.param encodeField <> $b|]+          Pe'Exp x -> [e|($(pure x) >$ E.param encodeField) <> $b|]           Pe'Var x -> [e|$(varE (nameArr ! x)) <> $b|]-     in foldr go [e|mempty|] enc+     in foldr go [e|E.noParams|] enc   body <- [e|Sql (getAp $(pure sqlBuilderExp)) $(pure encExp)|]   pure case spliceDecs of     [] -> body
test/Main.hs view
@@ -53,7 +53,8 @@         <$> [ testCase "basic" . testBasic,               testCase "composite test" . testComposite,               testCase "row" . testRow,-              testCase "row generic" . testRowGeneric+              testCase "row generic" . testRowGeneric,+              testCase "snippet" . testSnippet             ]     ) @@ -146,6 +147,15 @@   withLocalTransaction getDb \conn -> do     let expected = [Point 0 0, Point 1 1]     res <- run conn [sql| select * from (values (0,0), (1,1) ) as t |]+    res @?= expected++testSnippet :: IO Tmp.DB -> IO ()+testSnippet getDb = do+  withLocalTransaction getDb \conn -> do+    let expected = [Point 0 0]+    let snippet = [sql| t.y = 0 |]+    let xVal :: Int64 = 0+    res <- run conn [sql| select * from (values (0,0), (1,1) ) as t(x,y) where t.x = #{xVal} and ^{snippet} |]     res @?= expected  withLocalTransaction :: IO Tmp.DB -> (Hasql.Connection -> IO a) -> IO a