postgresql-config

Types for easy adding postgresql configuration to your program https://bitbucket.org/s9gf4ult/postgresql-config

Latest on Hackage:0.1.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Aleksey Uimanov
Maintained by s9gf4ult@gmail.com

What?

Simple types and set of functions to quickly add configuration of postgresql to your Yesod site or whatever.

How?

Add separate file or section inside your existing config like that

database:    "dbname"
host:        "127.0.0.1"       # optional
port:         5432             # optional
user:        "dbuser"
password:    "pass"
poolsize:    10               # optional maximum connections in pool
pooltimeout: 60               # optional minimum connection lifetime
poolstripes: 1                # optional count of stripes in pool

and then in your program something like that

conf <- decodeFile "pgconfig.yml"
         >>= maybe (fail "Could not parse pgconfig.yml") return
pool <- createPGPool conf
pingPGPool pool

So now you have a pool and can perform queries any way you like.

Changes

CHANGELOG

0.1.0

Added

  • createPGPoolWithCallback accepting callback which must be executed on each connection just after it opened by pool.

0.0.2

  • base constraints relaxed
  • changelog added
  • cabal file beautified

0.0.1

First version

comments powered byDisqus