hasql-optparse-applicative 0.3.0.8 → 0.3.0.9
raw patch · 2 files changed
+48/−41 lines, 2 filesdep ~hasql-poolPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hasql-pool
API changes (from Hackage documentation)
Files
hasql-optparse-applicative.cabal view
@@ -1,7 +1,7 @@ name: hasql-optparse-applicative version:- 0.3.0.8+ 0.3.0.9 synopsis: "optparse-applicative" parsers for "hasql" category:@@ -45,7 +45,7 @@ Hasql.OptparseApplicative build-depends: hasql >= 1.3 && < 1.6,- hasql-pool >= 0.5 && < 0.6,+ hasql-pool >= 0.5 && < 0.7, -- optparse-applicative >= 0.12 && < 0.18, --
library/Hasql/OptparseApplicative.hs view
@@ -1,64 +1,71 @@ module Hasql.OptparseApplicative where import BasePrelude hiding (option)-import Options.Applicative import qualified Hasql.Connection as A import qualified Hasql.Pool as B-+import Options.Applicative --- |--- Given a function, which updates the long names produces a parser of @B.'B.Settings'@.--- You can use this function to prefix the name or you can just specify 'id', if you don't want it changed.+-- | Given a function, which updates the long names produces a parser of+-- the @Hasql.Pool.'B.Settings'@.+--+-- You can use this function to prefix the name or you can just specify 'id',+-- if you don't want it changed. poolSettings :: (String -> String) -> Parser B.Settings poolSettings updatedName = (,,) <$> size <*> timeout <*> connectionSettings updatedName where size = option auto $- long (updatedName "pool-size") <>- value 1 <>- showDefault <>- help "Amount of connections in the pool"+ long (updatedName "pool-size")+ <> value 1+ <> showDefault+ <> help "Amount of connections in the pool" timeout = fmap fromIntegral $- option auto $- long (updatedName "pool-timeout") <>- value 10 <>- showDefault <>- help "Amount of seconds for which the unused connections are kept open"+ option auto $+ long (updatedName "pool-timeout")+ <> value 10+ <> showDefault+ <> help "Amount of seconds for which the unused connections are kept open" --- |--- Given a function, which updates the long names produces a parser of @A.'A.Settings'@.--- You can use this function to prefix the name or you can just specify 'id', if you don't want it changed.+-- | Given a function, which updates the long names produces a parser+-- of @Hasql.Connection.'A.Settings'@.+--+-- You can use this function to prefix the name or you can just specify 'id',+-- if you don't want it changed. connectionSettings :: (String -> String) -> Parser A.Settings connectionSettings updatedName = A.settings <$> host <*> port <*> user <*> password <*> database where host =- fmap fromString $ strOption $- long (updatedName "host") <> - value "127.0.0.1" <>- showDefault <>- help "Server host"+ fmap fromString $+ strOption $+ long (updatedName "host")+ <> value "127.0.0.1"+ <> showDefault+ <> help "Server host" port = option auto $- long (updatedName "port") <>- value 5432 <>- showDefault <>- help "Server port"+ long (updatedName "port")+ <> value 5432+ <> showDefault+ <> help "Server port" user =- fmap fromString $ strOption $- long (updatedName "user") <>- value "postgres" <>- showDefault <>- help "Username"+ fmap fromString $+ strOption $+ long (updatedName "user")+ <> value "postgres"+ <> showDefault+ <> help "Username" password =- fmap fromString $ strOption $- long (updatedName "password") <>- value "" <>- showDefault <>- help "Password"+ fmap fromString $+ strOption $+ long (updatedName "password")+ <> value ""+ <> showDefault+ <> help "Password" database =- fmap fromString $ strOption $- long (updatedName "database") <>- help "Database name"+ fmap fromString $+ strOption $+ long (updatedName "database")+ <> help "Database name"