Module

Database.Postgres

Package
purescript-node-postgres
Repository
epost/purescript-node-postgres

#Query Source

newtype Query a

Constructors

#Client Source

data Client :: Type

#Pool Source

data Pool :: Type

#ConnectionInfo Source

#ClientConfig Source

type ClientConfig = { database :: String, host :: String, password :: String, port :: Int, ssl :: Boolean, user :: String }

#PoolConfig Source

type PoolConfig = { connectionTimeoutMillis :: Int, idleTimeoutMillis :: Int, max :: Int }

#ConnectionString Source

#connect Source

connect :: Pool -> Aff Client

Makes a connection to the database via a Client.

#execute Source

execute :: forall a. Query a -> Array SqlValue -> Client -> Aff Unit

Runs a query and returns nothing.

#execute_ Source

execute_ :: forall a. Query a -> Client -> Aff Unit

Runs a query and returns nothing

#query Source

query :: forall a. (Foreign -> Either Error a) -> Query a -> Array SqlValue -> Client -> Aff (Array a)

Runs a query and returns all results.

#query_ Source

query_ :: forall a. (Foreign -> Either Error a) -> Query a -> Client -> Aff (Array a)

Just like query but does not make any param replacement

#queryValue Source

queryValue :: forall a. (Foreign -> Either Error a) -> Query a -> Array SqlValue -> Client -> Aff (Maybe a)

Runs a query and returns a single value, if any.

#queryValue_ Source

queryValue_ :: forall a. (Foreign -> Either Error a) -> Query a -> Client -> Aff (Maybe a)

Just like queryValue but does not make any param replacement

#queryOne Source

queryOne :: forall a. (Foreign -> Either Error a) -> Query a -> Array SqlValue -> Client -> Aff (Maybe a)

Runs a query and returns the first row, if any

#queryOne_ Source

queryOne_ :: forall a. (Foreign -> Either Error a) -> Query a -> Client -> Aff (Maybe a)

Just like queryOne but does not make any param replacement

#withClient Source

withClient :: forall a. Pool -> (Client -> Aff a) -> Aff a

Connects to the database, calls the provided function with the client and returns the results.