hasql 1.5.1 → 1.6
raw patch · 5 files changed
+19/−3 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Hasql.Session: ServerError :: ByteString -> ByteString -> Maybe ByteString -> Maybe ByteString -> ResultError
+ Hasql.Session: ServerError :: ByteString -> ByteString -> Maybe ByteString -> Maybe ByteString -> Maybe Int -> ResultError
Files
- CHANGELOG.md +4/−0
- hasql.cabal +1/−1
- library/Hasql/Private/Decoders/Result.hs +10/−1
- library/Hasql/Private/Errors.hs +3/−0
- tasty/Main.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 1.6++- Added position to `ServerError` (breaking change).+ # 1.5 - Added column number to `RowError` (breaking change).
hasql.cabal view
@@ -1,5 +1,5 @@ name: hasql-version: 1.5.1+version: 1.6 category: Hasql, Database, PostgreSQL synopsis: An efficient PostgreSQL driver with a flexible mapping API description:
library/Hasql/Private/Decoders/Result.hs view
@@ -81,7 +81,16 @@ LibPQ.resultErrorField result LibPQ.DiagMessageDetail hint <- LibPQ.resultErrorField result LibPQ.DiagMessageHint- pure $ Left $ ServerError code message detail hint+ position <-+ parsePosition <$> LibPQ.resultErrorField result LibPQ.DiagStatementPosition+ pure $ Left $ ServerError code message detail hint position+ where+ parsePosition = \case+ Nothing -> Nothing+ Just pos ->+ case Attoparsec.parseOnly (Attoparsec.decimal <* Attoparsec.endOfInput) pos of+ Right pos -> Just pos+ _ -> Nothing {-# INLINE maybe #-} maybe :: Row.Row a -> Result (Maybe a)
library/Hasql/Private/Errors.hs view
@@ -54,6 +54,9 @@ -- This is intended to differ from detail in that it offers advice -- (potentially inappropriate) rather than hard facts. Might run to -- multiple lines.+ (Maybe Int)+ -- ^ __Position__. Error cursor position as an index into the original+ -- statement string. Positions are measured in characters not bytes. | -- | -- The database returned an unexpected result. -- Indicates an improper statement or a schema mismatch.
tasty/Main.hs view
@@ -153,7 +153,7 @@ where resultTest = \case- Right (Left (Session.QueryError _ _ (Session.ResultError (Session.ServerError "26000" _ _ _)))) -> False+ Right (Left (Session.QueryError _ _ (Session.ResultError (Session.ServerError "26000" _ _ _ _)))) -> False _ -> True session = catchError session (const (pure ())) *> session