packages feed

esqueleto 1.2 → 1.2.1

raw patch · 3 files changed

+22/−10 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

esqueleto.cabal view
@@ -1,5 +1,5 @@ name:                esqueleto-version:             1.2+version:             1.2.1 synopsis:            Bare bones, type-safe EDSL for SQL queries on persistent backends. homepage:            https://github.com/meteficha/esqueleto license:             BSD3
src/Database/Esqueleto/Internal/Sql.hs view
@@ -700,20 +700,22 @@   uncommas :: [TLB.Builder] -> TLB.Builder-uncommas = mconcat . intersperse ", "+uncommas = mconcat . intersperse ", " . filter (/= mempty)  uncommas' :: Monoid a => [(TLB.Builder, a)] -> (TLB.Builder, a) uncommas' = (uncommas *** mconcat) . unzip   makeSelect :: SqlSelect a r => Connection -> Mode -> a -> (TLB.Builder, [PersistValue])-makeSelect conn mode ret = first (s <>) (sqlSelectCols conn ret)+makeSelect conn mode ret =+  case mode of+    SELECT          -> withCols "SELECT "+    SELECT_DISTINCT -> withCols "SELECT DISTINCT "+    DELETE          -> plain "DELETE "+    UPDATE          -> plain "UPDATE "   where-    s = case mode of-          SELECT          -> "SELECT "-          SELECT_DISTINCT -> "SELECT DISTINCT "-          DELETE          -> "DELETE"-          UPDATE          -> "UPDATE "+    withCols v = first (v <>) (sqlSelectCols conn ret)+    plain    v = (v, [])   makeFrom :: Connection -> Mode -> [FromClause] -> (TLB.Builder, [PersistValue])@@ -831,8 +833,8 @@  -- | Not useful for 'select', but used for 'update' and 'delete'. instance SqlSelect () () where-  sqlSelectCols _ _ = mempty-  sqlSelectColCount _ = 0+  sqlSelectCols _ _ = ("1", [])+  sqlSelectColCount _ = 1   sqlSelectProcessRow _ = Right ()  
test/Test.hs view
@@ -55,6 +55,16 @@           ret <- select $ return $ val (3 :: Int)           liftIO $ ret `shouldBe` [ Value 3 ] +      it "works for a pair of a single value and ()" $+        run $ do+          ret <- select $ return (val (3 :: Int), ())+          liftIO $ ret `shouldBe` [ (Value 3, ()) ]++      it "works for a single ()" $+        run $ do+          ret <- select $ return ()+          liftIO $ ret `shouldBe` [ () ]+       it "works for a single NULL value" $         run $ do           ret <- select $ return $ nothing