packages feed

postgresql-simple-url 0.2.0.0 → 0.2.1.0

raw patch · 3 files changed

+37/−15 lines, 3 filesdep ~basedep ~postgresql-simpledep ~tastyPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, postgresql-simple, tasty, tasty-quickcheck

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,4 +1,8 @@+# 0.2.1.0++- Accept `postgresql` schema (not only `postgres`)+ # 0.2.0.0 -Allow empty host, i.e. don't use default provided by `postgresql-simple`.-Empty host is required to use unix domain sockets.+- Allow empty host, i.e. don't use default provided by `postgresql-simple`.+ Empty host is required to use unix domain sockets.
postgresql-simple-url.cabal view
@@ -1,20 +1,33 @@ name:                postgresql-simple-url-version:             0.2.0.0+version:             0.2.1.0 synopsis:            Parse postgres:// url into ConnectInfo description:   The 'Database.PostgreSQL.Simple.URL' module in this package exports-  two helper functions 'parseDatabaseUrl' and 'urlToConnectInfo'.+  two helper functions 'parseDatabaseUrl' and 'urlToConnectInfo' to+  construct 'ConnectInfo' from URI (or string).+  .+  @+  >>> parseDatabaseUrl "postgres://foo:bar@example.com:2345/database"+  Just (ConnectInfo "example.com" 2345 "foo" "bar" "database")+  @ homepage:            https://github.com/futurice/postgresql-simple-url license:             MIT license-file:        LICENSE author:              Oleg Grenrus maintainer:          Oleg Grenrus <oleg.grenrus@iki.fi>-copyright:           Copyright © 2014 Futurice OY, Oleg Grenrus+copyright:           Copyright © 2014-2018 Futurice OY, Oleg Grenrus stability:           experimental-category:            Game+category:            Database build-type:          Simple extra-source-files:  README.md, CHANGELOG.md cabal-version:       >=1.10+tested-with:+  GHC==7.6.3,+  GHC==7.8.4,+  GHC==7.10.3,+  GHC==8.0.2,+  GHC==8.2.2,+  GHC==8.4.1  source-repository head   type: git@@ -22,7 +35,7 @@  library   exposed-modules:     Database.PostgreSQL.Simple.URL-  build-depends:       base               >=4.6 && <4.10,+  build-depends:       base               >=4.6 && <4.12,                        split              >=0.2 && <0.3,                        network-uri        >=2.6 && <2.7,                        postgresql-simple  >=0.4 && <0.6@@ -36,8 +49,8 @@   hs-source-dirs:      tests   main-is:             Tests.hs   ghc-options:         -Wall-  build-depends:       base               >=4.6  && <4.10,-                       tasty              >=0.10 && <0.12,-                       tasty-quickcheck   >=0.8  && <0.9,-                       postgresql-simple  >=0.4 && <0.6,+  build-depends:       base,+                       postgresql-simple,+                       tasty              >=0.10 && <1.1,+                       tasty-quickcheck   >=0.8  && <0.11,                        postgresql-simple-url
src/Database/PostgreSQL/Simple/URL.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Database.PostgreSQL.Simple.URL--- Copyright   :  2014, 2015 © Futurice OY, Oleg Grenrus+-- Copyright   :  2014-2018 © Futurice OY, Oleg Grenrus -- License     :  MIT (see the file LICENSE) -- -- Maintainer  :  Oleg Grenrus <oleg.grenrus@iki.fi>@@ -17,14 +17,19 @@  -- | Parse string url into `ConnectInfo`. ----- > parseDatabaseURL "postgres://foo:bar@example.com:2345/database" == ConnectInfo "example.com" 2345 "foo" "bar" "database"+-- >>> parseDatabaseUrl "postgres://foo:bar@example.com:2345/database"+-- Just (ConnectInfo {connectHost = "example.com", connectPort = 2345, connectUser = "foo", connectPassword = "bar", connectDatabase = "database"})+--+-- >>> parseDatabaseUrl "postgresql://foo:bar@example.com:2345/database"+-- Just (ConnectInfo {connectHost = "example.com", connectPort = 2345, connectUser = "foo", connectPassword = "bar", connectDatabase = "database"})+-- parseDatabaseUrl :: String -> Maybe ConnectInfo parseDatabaseUrl databaseUrl = parseURI databaseUrl >>= uriToConnectInfo  uriToConnectInfo :: URI -> Maybe ConnectInfo uriToConnectInfo uri-  | uriScheme uri /= "postgres:" = Nothing-  | otherwise                    = ($ defaultConnectInfo) <$> mkConnectInfo uri+  | uriScheme uri /= "postgres:" && uriScheme uri /= "postgresql:" = Nothing+  | otherwise = ($ defaultConnectInfo) <$> mkConnectInfo uri  type ConnectInfoChange = ConnectInfo -> ConnectInfo