postgresql-binary 0.7.4 → 0.7.4.1
raw patch · 5 files changed
+38/−21 lines, 5 filesdep ~base
Dependency ranges changed: base
Files
- library/PostgreSQL/Binary/Encoder.hs +1/−1
- library/PostgreSQL/Binary/Prelude.hs +1/−1
- postgresql-binary.cabal +2/−2
- tasty/Main/Apx.hs +33/−16
- tasty/Main/Prelude.hs +1/−1
library/PostgreSQL/Binary/Encoder.hs view
@@ -425,7 +425,7 @@ dimensionsLength <> nulls <> oid <> dimensions <> values where dimensionsLength = - int4_word32 $ fromIntegral $ length dimensionsV+ int4_word32 $ fromIntegral $ Vector.length dimensionsV nulls = int4_word32 $ if nullsV then 1 else 0 oid =
library/PostgreSQL/Binary/Prelude.hs view
@@ -91,4 +91,4 @@ joinMap :: Monad m => (a -> m b) -> m a -> m b joinMap f =- join . fmap f+ join . liftM f
postgresql-binary.cabal view
@@ -1,7 +1,7 @@ name: postgresql-binary version:- 0.7.4+ 0.7.4.1 synopsis: Encoders and decoders for the PostgreSQL's binary format description:@@ -15,7 +15,7 @@ and is tested against 8.3, 9.3 and 9.4 with the @integer_datetimes@ setting off and on. category:- Database, Codecs, Parsing+ PostgreSQL, Database, Codecs, Parsing homepage: https://github.com/nikita-volkov/postgresql-binary bug-reports:
tasty/Main/Apx.hs view
@@ -17,36 +17,53 @@ instance Eq (Apx LocalTime) where (==) (Apx a) (Apx b) =- localTimeRep a == localTimeRep b+ Apx (localTimeToSeconds a) ==+ Apx (localTimeToSeconds b) instance Eq (Apx UTCTime) where (==) (Apx a) (Apx b) =- utcTimeApxRep a == utcTimeApxRep b+ Apx (utcTimeToSeconds a) ==+ Apx (utcTimeToSeconds b) instance Eq (Apx TimeOfDay) where (==) (Apx a) (Apx b) =- timeOfDayApxRep a == timeOfDayApxRep b+ Apx (timeOfDayToSeconds a) ==+ Apx (timeOfDayToSeconds b) instance Eq (Apx TimeZone) where (==) (Apx a) (Apx b) = a == b +instance Eq (Apx Double) where+ (==) (Apx a) (Apx b) =+ toRational a == toRational b -utcTimeApxRep (UTCTime d d') =- (d, picoApxRep (unsafeCoerce d'))+instance Eq (Apx Rational) where+ (==) (Apx a) (Apx b) =+ a + error >= b &&+ a - error <= b+ where+ error =+ 10 ^^ negate 3 -localTimeRep (LocalTime d t) =- (d, timeOfDayApxRep t) -timetzApxRep (t, tz) = - (timeOfDayApxRep t, tz)+utcTimeToSeconds :: UTCTime -> Rational+utcTimeToSeconds (UTCTime days diffTime) =+ dayToSeconds days + diffTimeToSeconds diffTime -timeOfDayApxRep :: TimeOfDay -> (Int, Int, Integer)-timeOfDayApxRep (TimeOfDay h m s) =- (h, m, picoApxRep s)+diffTimeToSeconds :: DiffTime -> Rational+diffTimeToSeconds diffTime =+ unsafeCoerce diffTime % (10 ^ 12) -picoApxRep :: Pico -> Integer-picoApxRep s =- let p = unsafeCoerce s :: Integer- in floor (p % 10^6)+dayToSeconds :: Day -> Rational+dayToSeconds (ModifiedJulianDay day) =+ (unsafeCoerce day * 24 * 60 * 60) % 1 +localTimeToSeconds :: LocalTime -> Rational+localTimeToSeconds (LocalTime day tod) =+ dayToSeconds day ++ timeOfDayToSeconds tod++timeOfDayToSeconds :: TimeOfDay -> Rational+timeOfDayToSeconds (TimeOfDay h m s) =+ ((toInteger h * 60 + toInteger m) * 60) % 1 + unsafeCoerce s % (10 ^ 12)
tasty/Main/Prelude.hs view
@@ -97,4 +97,4 @@ joinMap :: Monad m => (a -> m b) -> m a -> m b joinMap f =- join . fmap f+ join . liftM f