hasql-postgres 0.7.2 → 0.7.3
raw patch · 2 files changed
+21/−31 lines, 2 filesdep ~hashtablesdep ~hasqlPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hashtables, hasql
API changes (from Hackage documentation)
Files
- hasql-postgres.cabal +6/−6
- tests/Main.hs +15/−25
hasql-postgres.cabal view
@@ -1,7 +1,7 @@ name: hasql-postgres version:- 0.7.2+ 0.7.3 synopsis: A "PostgreSQL" backend for the "hasql" library description:@@ -82,7 +82,7 @@ uuid == 1.3.*, vector == 0.10.*, time >= 1.4 && < 1.6,- hashtables == 1.1.*,+ hashtables >= 1.1 && < 1.3, scientific >= 0.2 && < 0.4, text >= 1 && < 1.3, bytestring >= 0.10 && < 0.11,@@ -128,14 +128,14 @@ -- parsers: attoparsec >= 0.10 && < 0.13, -- database:- hasql == 0.2.*,+ hasql == 0.4.*, postgresql-binary == 0.5.*, postgresql-libpq == 0.9.*, -- data: uuid == 1.3.*, vector == 0.10.*, time >= 1.4 && < 1.6,- hashtables == 1.1.*,+ hashtables >= 1.1 && < 1.3, scientific >= 0.2 && < 0.4, text >= 1 && < 1.3, bytestring >= 0.10 && < 0.11,@@ -171,7 +171,7 @@ build-depends: hasql-postgres, hasql-backend,- hasql == 0.2.*,+ hasql == 0.4.*, -- testing: HTF == 0.12.*, quickcheck-instances == 0.3.*,@@ -216,7 +216,7 @@ postgresql-simple == 0.4.*, hasql-postgres, hasql-backend,- hasql == 0.2.*,+ hasql == 0.4.*, -- random: QuickCheck == 2.7.*, quickcheck-instances == 0.3.*,
tests/Main.hs view
@@ -35,6 +35,18 @@ htfMain $ htf_thisModulesTests +test_wrongPort =+ let + backendSettings = H.Postgres "localhost" 1 "postgres" "" "postgres"+ poolSettings = fromJust $ sessionSettings 6 30+ io =+ H.session backendSettings poolSettings $ do+ H.tx Nothing $ H.unit [H.q|DROP TABLE IF EXISTS a|]+ in + assertThrowsIO io $ \case+ H.CantConnect _ -> True+ _ -> False+ test_sameStatementUsedOnDifferentTypes = session1 $ do liftIO . assertEqual (Just (Identity ("abc" :: Text))) =<< do @@ -77,28 +89,6 @@ id2 <- (fmap . fmap) runIdentity $ single $ [q|INSERT INTO a (v) VALUES (2) RETURNING id|] return (id1, id2) -test_transactionConflictResolution =- do- session1 $ tx Nothing $ do- unit [q|DROP TABLE IF EXISTS a|]- unit [q|CREATE TABLE a ("id" int8, "v" int8, PRIMARY KEY ("id"))|]- unit [q|INSERT INTO a (id, v) VALUES ('7', '0')|]- semaphore <- SSem.new (-1)- SlaveThread.fork $ session >> SSem.signal semaphore- SlaveThread.fork $ session >> SSem.signal semaphore- SSem.wait semaphore- r <- session1 $ tx Nothing $ single [q|SELECT v FROM a WHERE id='7'|]- assertEqual (Just (Identity (200 :: Int))) r- where- session =- session1 $ do- replicateM 100 $ tx (Just (Serializable, True)) $ do- Just (Identity (v :: Int)) <- single [q|SELECT v FROM a WHERE id='7'|]- unit $ [q|UPDATE a SET v=? WHERE id='7'|] (succ v)--test_transaction =- unitTestPending ""- test_cursorResultsOrder = session1 $ do r :: [Word] <-@@ -213,17 +203,17 @@ selectSelf :: Backend.Mapping Postgres a => - a -> Session Postgres IO (Maybe a)+ a -> Session Postgres s IO (Maybe a) selectSelf v = tx Nothing $ (fmap . fmap) runIdentity $ single $ [q| SELECT ? |] v validMappingSession :: Backend.Mapping Postgres a => Typeable a => Show a => Eq a => - a -> Session Postgres IO ()+ a -> Session Postgres s IO () validMappingSession v = selectSelf v >>= liftIO . assertEqual (Just v) -session1 :: Session Postgres IO r -> IO r+session1 :: (forall s. Session Postgres s IO r) -> IO r session1 = session backendSettings poolSettings where