postgresql-binary 0.7.4.1 → 0.7.5
raw patch · 3 files changed
+22/−3 lines, 3 files
Files
- postgresql-binary.cabal +2/−2
- tasty/Main.hs +19/−0
- tasty/Main/IO.hs +1/−1
postgresql-binary.cabal view
@@ -1,7 +1,7 @@ name: postgresql-binary version:- 0.7.4.1+ 0.7.5 synopsis: Encoders and decoders for the PostgreSQL's binary format description:@@ -67,7 +67,7 @@ -- parsing: binary-parser >= 0.5 && < 0.6, -- data:- aeson >= 0.10 && < 0.11,+ aeson >= 0.9 && < 0.11, uuid == 1.3.*, time >= 1.4 && < 1.6, scientific >= 0.2 && < 0.4,
tasty/Main.hs view
@@ -30,6 +30,24 @@ (bool Decoder.interval_float Decoder.interval_int) (picosecondsToDiffTime (10^6 * (332211 + 10^6 * (6 + 60 * (5 + 60 * (4 + 24 * (3 + 31 * (2 + 12)))))))) ,+ select "SELECT '10 seconds' :: interval"+ (bool Decoder.interval_float Decoder.interval_int)+ (10 :: DiffTime)+ ,+ HUnit.testCase "Interval encoder: 10 seconds" $+ let+ pti =+ PTI.interval+ encoder =+ (bool Encoder.interval_float Encoder.interval_int)+ decoder =+ (bool Decoder.interval_float Decoder.interval_int)+ value =+ (10 :: DiffTime)+ in+ HUnit.assertEqual "" (Right value) =<<+ IO.roundtrip (PTI.oidPQ (PTI.ptiOID pti)) encoder decoder value+ , timeRoundtrip "interval" Gens.intervalDiffTime PTI.interval (bool Encoder.interval_float Encoder.interval_int) (bool Decoder.interval_float Decoder.interval_int)@@ -211,4 +229,5 @@ HUnit.testCase (show statement) $ HUnit.assertEqual "" (Right value) $ unsafePerformIO $ IO.parameterlessStatement statement decoder value+
tasty/Main/IO.hs view
@@ -31,7 +31,7 @@ bytes = (convert . encoder) value -roundtrip :: DB.Oid -> (Bool -> Encoder.Encoder a) -> (Bool -> Decoder.Decoder a) -> a -> IO (Either Text a)+roundtrip :: DB.Oid -> (Bool -> Encoder.Encoder a) -> (Bool -> Decoder.Decoder b) -> a -> IO (Either Text b) roundtrip oid encoder decoder value = fmap (either (Left . Text.decodeUtf8) id) $ DB.session $ do