Module

Effect.Aff.Postgres.Pool

Package
purescript-postgresql
Repository
cakekindel/purescript-postgresql

#connect Source

connect :: Pool -> Except Aff Client

Acquires a client from the pool.

  • If there are idle clients in the pool one will be returned to the callback on process.nextTick.
  • If the pool is not full but all current clients are checked out a new client will be created & returned to this callback.
  • If the pool is 'full' and all clients are currently checked out will wait in a FIFO queue until a client becomes available by it being released back to the pool.

https://node-postgres.com/apis/pool#poolconnect

#end Source

end :: Pool -> Except Aff Unit

Drain the pool of all active clients, disconnect them, and shut down any internal timers in the pool.

It is common to call this at the end of a script using the pool or when your process is attempting to shut down cleanly.

https://node-postgres.com/apis/pool#poolend

#__end Source

__end :: Pool -> Effect (Promise Unit)

FFI binding to Pool#end

#__connect Source

__connect :: Pool -> Effect (Promise Client)

FFI binding to Pool#connect

Re-exports from Effect.Postgres.Pool

#PoolConfigRaw Source

data PoolConfigRaw

FFI type for import('pg').PoolConfig

#Pool Source

data Pool

Database connection pool

#Config Source

type Config :: Row Type -> Row Typetype Config r = Config + (allowExitOnIdle :: Boolean, idleTimeout :: Milliseconds, max :: Int | r)

Pool construction config

Includes all Client config options

#make Source

make :: forall @r @missing @trash. Union r missing (Config trash) => Record r -> Effect Pool

Creates a new pool

The config parameter r is Config with all keys optional.

https://node-postgres.com/apis/pool#new-pool

#clientWaitingCount Source

clientWaitingCount :: Pool -> Int

The number of queued requests waiting on a client when all clients are checked out. It can be helpful to monitor this number to see if you need to adjust the size of the pool.

#clientIdleCount Source

clientIdleCount :: Pool -> Int

The number of clients which are not checked out but are currently idle in the pool.

#clientCount Source

clientCount :: Pool -> Int

The total number of clients existing within the pool.