packages feed

postgres-options 0.2.1.0 → 0.2.2.0

raw patch · 3 files changed

+12/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

postgres-options.cabal view
@@ -1,5 +1,5 @@ name:                postgres-options-version:             0.2.1.0+version:             0.2.2.0 synopsis:            An Options type representing options for postgres connections description:         This package exports an Options type representing options for postgres connections homepage:            https://github.com/jfischoff/postgres-options#readme
src/Database/PostgreSQL/Simple/Options.hs view
@@ -178,12 +178,14 @@  uriToptions :: URIRef Absolute -> Either String Options uriToptions URI {..} = case schemeBS uriScheme of-  "postgresql" -> do-    queryParts <- queryToptions uriQuery-    return $ maybe mempty authorityToOptions uriAuthority <>-      pathToptions uriPath <> queryParts--  x -> Left $ "Wrong protocol. Expected \"postgresql\" but got: " ++ show x+  "postgres" -> options+  "postgresql" -> options+  x -> Left $ "Wrong protocol. Expected \"postgres\" or \"postgresql\" but got: " ++ show x+  where+    options = do+      queryParts <- queryToptions uriQuery+      return $ maybe mempty authorityToOptions uriAuthority <>+        pathToptions uriPath <> queryParts  parseURIStr :: String -> Either String (URIRef Absolute) parseURIStr = left show . parseURI strictURIParserOptions . BSC.pack where
test/Spec.hs view
@@ -43,3 +43,6 @@         { host = return "/var/lib/postgresql"         , dbname = return "dbname"         })++  it "accepts postgres" $ parseConnectionString "postgres://localhost"+    `shouldBe` Right (mempty { host = return "localhost" })