Module

Database.PostgreSQL

Package
purescript-postgresql-client
Repository
rightfold/purescript-postgresql-client

#PGErrorDetail Source

type PGErrorDetail = { code :: String, column :: String, constraint :: String, dataType :: String, detail :: String, file :: String, hint :: String, internalPosition :: String, internalQuery :: String, line :: String, message :: String, position :: String, routine :: String, schema :: String, severity :: String, table :: String, where_ :: String }

#Database Source

#PoolConfiguration Source

type PoolConfiguration = { database :: Database, host :: Maybe String, idleTimeoutMillis :: Maybe Int, max :: Maybe Int, password :: Maybe String, port :: Maybe Int, user :: Maybe String }

PostgreSQL connection pool configuration.

#Pool Source

data Pool :: Type

PostgreSQL connection pool.

#Connection Source

data Connection :: Type

PostgreSQL connection.

#Query Source

newtype Query i o

PostgreSQL query with parameter ($1, $2, …) and return types.

Constructors

Instances

#newPool Source

newPool :: PoolConfiguration -> Effect Pool

Create a new connection pool.

#withConnection Source

withConnection :: forall a. Pool -> (Either PGError Connection -> Aff a) -> Aff a

Run an action with a connection. The connection is released to the pool when the action returns.

#withTransaction Source

withTransaction :: forall a. Connection -> Aff a -> Aff (Either PGError a)

Run an action within a transaction. The transaction is committed if the action returns cleanly, and rolled back if the action throws (either a PGError or a JavaScript exception in the Aff context). If you want to change the transaction mode, issue a separate SET TRANSACTION statement within the transaction.

#command Source

command :: forall i. ToSQLRow i => Connection -> Query i Int -> i -> Aff (Either PGError Int)

Execute a PostgreSQL query and return its command tag value (how many rows were affected by the query). This may be useful for example with DELETE or UPDATE queries.

#execute Source

execute :: forall o i. ToSQLRow i => Connection -> Query i o -> i -> Aff (Maybe PGError)

Execute a PostgreSQL query and discard its results.

#query Source

query :: forall o i. ToSQLRow i => FromSQLRow o => Connection -> Query i o -> i -> Aff (Either PGError (Array o))

Execute a PostgreSQL query and return its results.

#scalar Source

scalar :: forall o i. ToSQLRow i => FromSQLValue o => Connection -> Query i (Row1 o) -> i -> Aff (Either PGError (Maybe o))

Execute a PostgreSQL query and return the first field of the first row in the result.

Re-exports from Database.PostgreSQL.Row

#Row9 Source

data Row9 a b c d e f g h i

A row with 9 fields.

Constructors

  • Row9 a b c d e f g h i

Instances

#Row8 Source

data Row8 a b c d e f g h

A row with 8 fields.

Constructors

  • Row8 a b c d e f g h

Instances

#Row7 Source

data Row7 a b c d e f g

A row with 7 fields.

Constructors

Instances

#Row6 Source

data Row6 a b c d e f

A row with 6 fields.

Constructors

Instances

#Row5 Source

data Row5 a b c d e

A row with 5 fields.

Constructors

Instances

#Row4 Source

data Row4 a b c d

A row with 4 fields.

Constructors

Instances

#Row3 Source

data Row3 a b c

A row with 3 fields.

Constructors

Instances

#Row2 Source

data Row2 a b

A row with 2 fields.

Constructors

Instances

#Row19 Source

data Row19 a b c d e f g h i j k l m n o p q r s

A row with 19 fields.

Constructors

  • Row19 a b c d e f g h i j k l m n o p q r s

Instances

#Row18 Source

data Row18 a b c d e f g h i j k l m n o p q r

A row with 18 fields.

Constructors

  • Row18 a b c d e f g h i j k l m n o p q r

Instances

#Row17 Source

data Row17 a b c d e f g h i j k l m n o p q

A row with 17 fields.

Constructors

  • Row17 a b c d e f g h i j k l m n o p q

Instances

#Row16 Source

data Row16 a b c d e f g h i j k l m n o p

A row with 16 fields.

Constructors

  • Row16 a b c d e f g h i j k l m n o p

Instances

#Row15 Source

data Row15 a b c d e f g h i j k l m n o

A row with 15 fields.

Constructors

  • Row15 a b c d e f g h i j k l m n o

Instances

#Row14 Source

data Row14 a b c d e f g h i j k l m n

A row with 14 fields.

Constructors

  • Row14 a b c d e f g h i j k l m n

Instances

#Row13 Source

data Row13 a b c d e f g h i j k l m

A row with 13 fields.

Constructors

  • Row13 a b c d e f g h i j k l m

Instances

#Row12 Source

data Row12 a b c d e f g h i j k l

A row with 12 fields.

Constructors

  • Row12 a b c d e f g h i j k l

Instances

#Row11 Source

data Row11 a b c d e f g h i j k

A row with 11 fields.

Constructors

  • Row11 a b c d e f g h i j k

Instances

#Row10 Source

data Row10 a b c d e f g h i j

A row with 10 fields.

Constructors

  • Row10 a b c d e f g h i j

Instances

#Row1 Source

data Row1 a

A row with 1 field.

Constructors

Instances

#Row0 Source

data Row0

A row with 0 fields.

Constructors

Instances

#FromSQLRow Source

class FromSQLRow a  where

Convert things from SQL rows.

Members

Instances

#ToSQLRow Source

class ToSQLRow a  where

Convert things to SQL rows.

Members

Instances

Re-exports from Database.PostgreSQL.Value

#unsafeIsBuffer Source

unsafeIsBuffer :: forall a. a -> Boolean

#instantToString Source