esqueleto 1.0.2 → 1.0.3
raw patch · 3 files changed
+17/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- esqueleto.cabal +1/−1
- src/Database/Esqueleto/Internal/Sql.hs +1/−1
- test/Test.hs +15/−0
esqueleto.cabal view
@@ -1,5 +1,5 @@ name: esqueleto-version: 1.0.2+version: 1.0.3 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
@@ -762,7 +762,7 @@ makeOrderBy _ [] = mempty makeOrderBy conn os = first ("\nORDER BY " <>) $ uncommas' (map mk os) where- mk (EOrderBy t (ERaw _ f)) = first (<> orderByType t) (f conn)+ mk (EOrderBy t (ERaw p f)) = first ((<> orderByType t) . parensM p) (f conn) orderByType ASC = " ASC" orderByType DESC = " DESC"
test/Test.hs view
@@ -385,6 +385,21 @@ return p liftIO $ ret `shouldBe` [ p1e, p4e, p3e, p2e ] + it "works with a sub_select" $+ run $ do+ [p1k, p2k, p3k, p4k] <- mapM insert [p1, p2, p3, p4]+ [b1k, b2k, b3k, b4k] <- mapM (insert . BlogPost "") [p1k, p2k, p3k, p4k]+ ret <- select $+ from $ \b -> do+ orderBy [desc $ sub_select $+ from $ \p -> do+ where_ (p ^. PersonId ==. b ^. BlogPostAuthorId)+ return (p ^. PersonName)+ ]+ return (b ^. BlogPostId)+ liftIO $ ret `shouldBe` (Value <$> [b2k, b3k, b4k, b1k])++ describe "selectDistinct" $ it "works on a simple example" $ run $ do