servant-postgresql-0.1: Useful functions and instances for using servant with a PostgreSQL context

Stabilityexperimental
MaintainerAlp Mestanogullari <alp@zalora.com>
Safe HaskellNone

Servant.Context.PostgreSQL

Contents

Description

Useful functions and instances for using servant with a PostgreSQL database.

Synopsis

PostgreSQL Context

contextOfConnInfo :: ConnectInfo -> Context ConnectionSource

Create a Context Connection from the given ConnectInfo.

This means a new connection will be fired whenever you perform a database operation. If you want to avoid that, see the pooledContextOfXXX functions.

contextOfConnStr :: ByteString -> Context ConnectionSource

Create a Context Connection from the given connection string.

This means a new connection will be fired whenever you perform a database operation. If you want to avoid that, see the pooledContextOfXXX functions.

PostgreSQL Context with connection pooling

pooledContextOfConnInfoSource

Arguments

:: Int

Number of stripes (sub-pools). Minimum: 1

-> NominalDiffTime

amount of time during which an unused Connection is kept open

-> Int

Maximum number of resources to keep open per stripe. Minimum: 1

-> ConnectInfo

connection information

-> IO (Context Connection) 

Create a Context that'll use a Pool of PostgreSQL Connections internally, from a ConnectInfo value.

pooledContextOfConnStrSource

Arguments

:: Int

Number of stripes (sub-pools). Minimum: 1

-> NominalDiffTime

amount of time during which an unused Connection is kept open

-> Int

Maximum number of resources to keep open per stripe. Minimum: 1

-> ByteString

connection string

-> IO (Context Connection) 

Create a Context that'll use a Pool of PostgreSQL Connections internally, from a connection string (a ByteString).