Hello community,

here is the log from the commit of package ghc-esqueleto for openSUSE:Factory 
checked in at 2017-06-22 10:37:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-esqueleto (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-esqueleto.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-esqueleto"

Thu Jun 22 10:37:21 2017 rev:5 rq:504064 version:2.5.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-esqueleto/ghc-esqueleto.changes      
2017-04-11 09:44:30.582619750 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-esqueleto.new/ghc-esqueleto.changes 
2017-06-22 10:37:22.943089390 +0200
@@ -1,0 +2,5 @@
+Wed May 31 14:01:12 UTC 2017 - [email protected]
+
+- Update to version 2.5.2.
+
+-------------------------------------------------------------------

Old:
----
  esqueleto-2.5.1.tar.gz
  esqueleto.cabal

New:
----
  esqueleto-2.5.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-esqueleto.spec ++++++
--- /var/tmp/diff_new_pack.tOyLIB/_old  2017-06-22 10:37:23.642990721 +0200
+++ /var/tmp/diff_new_pack.tOyLIB/_new  2017-06-22 10:37:23.646990158 +0200
@@ -19,14 +19,13 @@
 %global pkg_name esqueleto
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.5.1
+Version:        2.5.2
 Release:        0
 Summary:        Type-safe EDSL for SQL queries on persistent backends
 License:        BSD-3-Clause
 Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Source1:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-blaze-html-devel
 BuildRequires:  ghc-bytestring-devel
@@ -90,7 +89,6 @@
 
 %prep
 %setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
 
 %build
 %ghc_lib_build

++++++ esqueleto-2.5.1.tar.gz -> esqueleto-2.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/esqueleto-2.5.1/esqueleto.cabal 
new/esqueleto-2.5.2/esqueleto.cabal
--- old/esqueleto-2.5.1/esqueleto.cabal 2017-01-22 19:54:35.000000000 +0100
+++ new/esqueleto-2.5.2/esqueleto.cabal 2017-05-25 18:57:00.000000000 +0200
@@ -1,5 +1,5 @@
 name:                esqueleto
-version:             2.5.1
+version:             2.5.2
 synopsis:            Type-safe EDSL for SQL queries on persistent backends.
 homepage:            https://github.com/bitemyapp/esqueleto
 license:             BSD3
@@ -63,10 +63,10 @@
   other-modules:
     Database.Esqueleto.Internal.PersistentImport
   build-depends:
-      base                 >= 4.5     && < 5.0
+      base                 >= 4.8     && < 5.0
     , bytestring
     , text                 >= 0.11    && < 1.3
-    , persistent           >= 2.5 && < 2.7
+    , persistent           >= 2.5 && < 2.8
     , transformers         >= 0.2
     , unordered-containers >= 0.2
     , tagged               >= 0.2
@@ -97,7 +97,7 @@
     , HUnit
     , QuickCheck
     , hspec               >= 1.8
-    , persistent-sqlite   >= 2.1
+    , persistent-sqlite   >= 2.1.3
     , persistent-template >= 2.1
     , monad-control
     , monad-logger        >= 0.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/esqueleto-2.5.1/src/Database/Esqueleto/Internal/Sql.hs 
new/esqueleto-2.5.2/src/Database/Esqueleto/Internal/Sql.hs
--- old/esqueleto-2.5.1/src/Database/Esqueleto/Internal/Sql.hs  2017-01-22 
19:46:18.000000000 +0100
+++ new/esqueleto-2.5.2/src/Database/Esqueleto/Internal/Sql.hs  2017-05-25 
18:52:09.000000000 +0200
@@ -76,7 +76,6 @@
 
 import Database.Esqueleto.Internal.Language
 
-
 -- | SQL backend for @esqueleto@ using 'SqlPersistT'.
 newtype SqlQuery a =
   Q { unQ :: W.WriterT SideData (S.State IdentState) a }
@@ -1099,13 +1098,19 @@
 makeGroupBy _ (GroupBy []) = (mempty, [])
 makeGroupBy info (GroupBy fields) = first ("\nGROUP BY " <>) build
   where
-    build = uncommas' $ map (\(SomeValue (ERaw _ f)) -> f info) fields
+    build :: (TLB.Builder, [PersistValue])
+    build = uncommas' $ map match fields
+
+    match :: SomeValue SqlExpr -> (TLB.Builder, [PersistValue])
+    match (SomeValue (ERaw _ f)) = f info
+    match (SomeValue (ECompositeKey f)) = (mconcat $ f info, mempty)
 
 makeHaving :: IdentInfo -> WhereClause -> (TLB.Builder, [PersistValue])
 makeHaving _    NoWhere                    = mempty
 makeHaving info (Where (ERaw _ f))         = first ("\nHAVING " <>) (f info)
-makeHaving _    (Where (ECompositeKey _ )) = unexpectedCompositeKeyError 
"makeHaving"
+makeHaving _    (Where (ECompositeKey _)) = unexpectedCompositeKeyError 
"makeHaving"
 
+-- makeHaving, makeWhere and makeOrderBy
 makeOrderBy :: IdentInfo -> [OrderByClause] -> (TLB.Builder, [PersistValue])
 makeOrderBy _    [] = mempty
 makeOrderBy info os = first ("\nORDER BY " <>) . uncommas' $ concatMap mk os
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/esqueleto-2.5.1/src/Database/Esqueleto/PostgreSQL.hs 
new/esqueleto-2.5.2/src/Database/Esqueleto/PostgreSQL.hs
--- old/esqueleto-2.5.1/src/Database/Esqueleto/PostgreSQL.hs    2016-12-15 
01:30:10.000000000 +0100
+++ new/esqueleto-2.5.2/src/Database/Esqueleto/PostgreSQL.hs    2017-04-28 
07:37:03.000000000 +0200
@@ -20,7 +20,6 @@
 arrayAgg :: SqlExpr (Value a) -> SqlExpr (Value [a])
 arrayAgg = unsafeSqlFunction "array_agg"
 
-
 -- | (@string_agg@) Concatenate input values separated by a
 -- delimiter.
 --
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/esqueleto-2.5.1/test/Test.hs 
new/esqueleto-2.5.2/test/Test.hs
--- old/esqueleto-2.5.1/test/Test.hs    2017-01-22 19:46:18.000000000 +0100
+++ new/esqueleto-2.5.2/test/Test.hs    2017-05-25 18:59:50.000000000 +0200
@@ -28,6 +28,9 @@
 import Database.Esqueleto
 #if   defined (WITH_POSTGRESQL)
 import Database.Persist.Postgresql (withPostgresqlConn)
+import Data.Ord (comparing)
+import Control.Arrow ((&&&))
+import qualified Database.Esqueleto.PostgreSQL as EP
 #elif defined (WITH_MYSQL)
 import Database.Persist.MySQL ( withMySQLConn
                               , connectHost
@@ -35,12 +38,9 @@
                               , connectUser
                               , connectPassword
                               , defaultConnectInfo)
-#else
+#endif
 import Database.Persist.Sqlite (withSqliteConn)
-#if MIN_VERSION_persistent_sqlite(2,1,3)
 import Database.Sqlite (SqliteException)
-#endif
-#endif
 import Database.Persist.TH
 import Test.Hspec
 
@@ -69,6 +69,19 @@
     title String
     authorId PersonId
     deriving Eq Show
+
+  Lord
+    county String
+    dogs Int Maybe
+    Primary county
+    deriving Show
+
+  Deed
+    contract String
+    ownerId LordId
+    Primary contract
+    deriving Show
+
   Follow
     follower PersonId
     followed PersonId
@@ -129,6 +142,10 @@
       p3 = Person "Mike"   (Just 17) Nothing   3
       p4 = Person "Livia"  (Just 17) (Just 18) 4
       p5 = Person "Mitch"  Nothing   Nothing   5
+      l1 = Lord "Cornwall" (Just 36)
+      l2 = Lord "Dorset" Nothing
+      l3 = Lord "Chester" (Just 17)
+
   hspec $ do
     describe "select" $ do
       it "works for a single value" $
@@ -825,7 +842,7 @@
                  distinctOn [don (bp ^. BlogPostAuthorId)] $ do
                  orderBy [asc (bp ^. BlogPostAuthorId), desc (bp ^. 
BlogPostTitle)]
                  return bp
-          liftIO $ ret `shouldBe` sortBy (comparing (blogPostAuthorId . 
entityVal)) [bpB, bpC]
+          liftIO $ ret `shouldBe` L.sortBy (comparing (blogPostAuthorId . 
entityVal)) [bpB, bpC]
 
       let slightlyLessSimpleTest q =
             run $ do
@@ -838,7 +855,7 @@
                      from $ \bp ->
                      q bp $ return bp
               let cmp = (blogPostAuthorId &&& blogPostTitle) . entityVal
-              liftIO $ ret `shouldBe` sortBy (comparing cmp) [bpA, bpB, bpC]
+              liftIO $ ret `shouldBe` L.sortBy (comparing cmp) [bpA, bpB, bpC]
       it "works on a slightly less simple example (two distinctOn calls, 
orderBy)" $
         slightlyLessSimpleTest $ \bp act ->
           distinctOn [don (bp ^. BlogPostAuthorId)] $
@@ -915,12 +932,8 @@
       it "throws an exception on SQLite with <2 arguments" $
         run (select $
              from $ \p -> do
-             return (coalesce [p ^. PersonAge]) :: SqlQuery (SqlExpr (Value 
(Maybe Int)))
-#if MIN_VERSION_persistent_sqlite(2,1,3)
-        ) `shouldThrow` (\(_ :: SqliteException) -> True)
-#else
-        ) `shouldThrow` (\(_ :: IOException) -> True)
-#endif
+             return (coalesce [p ^. PersonAge]) :: SqlQuery (SqlExpr (Value 
(Maybe Int))))
+        `shouldThrow` (\(_ :: SqliteException) -> True)
 #endif
 
     describe "text functions" $ do
@@ -1073,6 +1086,23 @@
                                   , (Entity p1k p1, Value 3)
                                   , (Entity p3k p3, Value 7) ]
 
+      it "GROUP BY works with COUNT and InnerJoin" $
+        run $ do
+          l1k <- insert l1
+          l2k <- insert l2
+          l3k <- insert l3
+          mapM_ (\k -> insert $ Deed k l1k) (map show [1..3])
+
+          mapM_ (\k -> insert $ Deed k l3k) (map show [4..10])
+
+          (ret :: [(Value (Key Lord), Value Int)]) <- select $ from $
+            \ ( lord `InnerJoin` deed ) -> do
+            on $ lord ^. LordId ==. deed ^. DeedOwnerId
+            groupBy (lord ^. LordId)
+            return (lord ^. LordId, count $ deed ^. DeedId)
+          liftIO $ ret `shouldBe` [ (Value l3k, Value 7)
+                                  , (Value l1k, Value 3) ]
+
       it "GROUP BY works with HAVING" $
         run $ do
           p1k <- insert p1
@@ -1181,7 +1211,6 @@
                  return p
           liftIO $ ret `shouldBe` [ Entity p2k p2 ]
 
-
     describe "list fields" $ do
       -- <https://github.com/prowdsponsor/esqueleto/issues/100>
       it "can update list fields" $
@@ -1365,9 +1394,7 @@
           let people = [p1, p2, p3, p4, p5]
           mapM_ insert people
           [Value ret] <-
-            select $
-            from $ \p -> do
-            return (EP.arrayAgg (p ^. PersonName))
+            select . from $ \p -> return (EP.arrayAgg (p ^. PersonName))
           liftIO $ L.sort ret `shouldBe` L.sort (map personName people)
 
       it "stringAgg looks sane" $
@@ -1410,10 +1437,15 @@
   :: (forall m. RunDbMonad m
   => SqlPersistT (R.ResourceT m) ())
 cleanDB = do
+  delete $ from $ \(_ :: SqlExpr (Entity Foo))  -> return ()
+  delete $ from $ \(_ :: SqlExpr (Entity Bar))  -> return ()
+
   delete $ from $ \(_ :: SqlExpr (Entity BlogPost))   -> return ()
   delete $ from $ \(_ :: SqlExpr (Entity Follow))     -> return ()
   delete $ from $ \(_ :: SqlExpr (Entity Person))     -> return ()
 
+  delete $ from $ \(_ :: SqlExpr (Entity CcList))  -> return ()
+
   delete $ from $ \(_ :: SqlExpr (Entity ArticleTag)) -> return ()
   delete $ from $ \(_ :: SqlExpr (Entity Article))    -> return ()
   delete $ from $ \(_ :: SqlExpr (Entity Article2))   -> return ()


Reply via email to