packages feed

hasql-postgres 0.4.0 → 0.5.0

raw patch · 4 files changed

+22/−101 lines, 4 filesdep ~postgresql-binaryPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: postgresql-binary

API changes (from Hackage documentation)

Files

hasql-postgres.cabal view
@@ -1,13 +1,16 @@ name:   hasql-postgres version:-  0.4.0+  0.5.0 synopsis:   A "PostgreSQL" backend for the "hasql" library description:   This library provides a \"PostgreSQL\" driver for    <http://hackage.haskell.org/package/hasql the "hasql" library>.   .+  It's tested against Postgres versions 8.3 and 9.3+  with the @integer_datetimes@ setting off and on.+  .   According to the included benchmarks,   it performs up to 2x faster than \"postgresql-simple\" and   up to 7x faster than \"HDBC\".@@ -72,7 +75,7 @@     attoparsec == 0.12.*,     -- database:     hasql-backend == 0.1.*,-    postgresql-binary == 0.2.*,+    postgresql-binary == 0.3.*,     postgresql-libpq == 0.9.*,     -- data:     uuid == 1.3.*,@@ -123,7 +126,7 @@     attoparsec == 0.12.*,     -- database:     hasql >= 0.1.4 && < 0.2,-    postgresql-binary == 0.2.*,+    postgresql-binary == 0.3.*,     postgresql-libpq == 0.9.*,     -- data:     uuid == 1.3.*,
library/Hasql/Postgres.hs view
@@ -346,24 +346,21 @@   parseResult = parseResultUsingMapping  -- |--- Maps to @timestamptz@.--- --- /NOTICE/--- --- Postgres does not store the timezone information of @timestamptz@.--- Instead it stores a UTC value and silently interconverts --- the incoming and outgoing values into a local time --- of the client application according to client application's timezone.--- --- This is a notoriously questionable design decision by the Postgres authors.--- This is why it is instead recommended to use @timestamp@ and 'UTCTime',--- while manually handling the timezone conversions on the application side.+-- Maps to @timestamp@. instance Backend.Mapping Postgres LocalTime where   renderValue = renderValueUsingMapping   parseResult = parseResultUsingMapping  -- |--- Maps to @timestamp@.+-- Maps to @timestamptz@.+-- +-- /NOTICE/+-- +-- Postgres does not store the timezone information of @timestamptz@.+-- Instead it stores a UTC value and performs silent conversions+-- to the currently set timezone, when dealt with in the text format.+-- However this library bypasses the silent conversions+-- and communicates with Postgres using the UTC values directly. instance Backend.Mapping Postgres UTCTime where   renderValue = renderValueUsingMapping   parseResult = parseResultUsingMapping
library/Hasql/Postgres/Mapping.hs view
@@ -205,16 +205,16 @@         [|Decoder.timetz|]       ,       (,,,)-        [t|UTCTime|]+        [t|LocalTime|]         [|PTI.timestamp|]-        [|const $ Encoder.timestamp|]-        [|const $ Decoder.timestamp|]+        [|Encoder.timestamp|]+        [|Decoder.timestamp|]       ,       (,,,)-        [t|LocalTime|]+        [t|UTCTime|]         [|PTI.timestamptz|]-        [|const $ Encoder.timestamptz|]-        [|const $ Decoder.timestamptz|]+        [|Encoder.timestamptz|]+        [|Decoder.timestamptz|]       ,       (,,,)         [t|DiffTime|]
tests/Main.hs view
@@ -170,91 +170,12 @@ prop_mappingOfListOverLazyByteString (x :: [LazyByteString]) =   mappingProp x -test_mappingOfBool =-  session1 $ do-    validMappingSession True-    validMappingSession False--test_mappingOfUTF8Char =-  session1 $ do-    validMappingSession 'Й'---- Postgres does not allow the '/NUL' character in text data-prop_mappingOfChar (v :: Char) =-  (v /= '\NUL') ==>-    mappingProp v---- Postgres does not allow the '/NUL' character in text data-prop_mappingOfText (v :: Text) =-  (isNothing $ Data.Text.find (== '\NUL') v) ==>-    mappingProp v- prop_mappingOfLazyText (v :: LazyText) =   (isNothing $ Data.Text.Lazy.find (== '\NUL') v) ==>     mappingProp v -prop_mappingOfByteString (v :: ByteString) =-  mappingProp v- prop_mappingOfLazyByteString (v :: LazyByteString) =   mappingProp v--prop_mappingOfInt (v :: Int) =-  mappingProp v--prop_mappingOfInt8 (v :: Int8) =-  mappingProp v--prop_mappingOfInt16 (v :: Int16) =-  mappingProp v--prop_mappingOfInt32 (v :: Int32) =-  mappingProp v--prop_mappingOfInt64 (v :: Int64) =-  mappingProp v--prop_mappingOfWord (v :: Word) =-  mappingProp v--prop_mappingOfWord8 (v :: Word8) =-  mappingProp v--prop_mappingOfWord16 (v :: Word16) =-  mappingProp v--prop_mappingOfWord32 (v :: Word32) =-  mappingProp v--prop_mappingOfWord64 (v :: Word64) =-  mappingProp v--prop_mappingOfFloat (v :: Float) =-  floatEqProp v (fromJust $ unsafePerformIO $ session1 $ selectSelf v)--prop_mappingOfDouble (v :: Double) =-  floatEqProp v (fromJust $ unsafePerformIO $ session1 $ selectSelf v)--prop_mappingOfScientific =-  forAll scientificGen $ \v ->-    mappingProp v--prop_mappingOfDay (v :: Day) =-  mappingProp v--prop_mappingOfTimeOfDay (v :: TimeOfDay) =-  forAll microsTimeOfDayGen $ \v -> -    mappingProp v--prop_mappingOfLocalTime =-  forAll microsLocalTimeGen $ \v -> -    mappingProp v--prop_mappingOfUTCTime =-  forAll gen $ \v ->-    mappingProp v-  where-    gen = UTCTime <$> arbitrary <*> microsDiffTimeGen   -- * Helpers