Module

Database.PostgreSQL.PG

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

#Database Source

#command Source

command :: forall m i. ToSQLRow i => MonadError PGError m => MonadAff m => Connection -> Query i Int -> i -> m 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 m o i. ToSQLRow i => MonadError PGError m => MonadAff m => Connection -> Query i o -> i -> m Unit

Execute a PostgreSQL query and discard its results.

#query Source

query :: forall m o i. ToSQLRow i => FromSQLRow o => MonadError PGError m => MonadAff m => Connection -> Query i o -> i -> m (Array o)

Execute a PostgreSQL query and return its results.

#onIntegrityError Source

onIntegrityError :: forall m a. MonadError PGError m => m a -> m a -> m a

#scalar Source

scalar :: forall m o i. ToSQLRow i => FromSQLValue o => MonadError PGError m => MonadAff m => Connection -> Query i (Row1 o) -> i -> m (Maybe o)

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

#withConnection Source

withConnection :: forall m a. MonadError PGError m => MonadAff m => (m a -> Aff (Either PGError a)) -> Pool -> (Connection -> m a) -> m a

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

#withTransaction Source

withTransaction :: forall m a. MonadAff m => MonadError PGError m => (m a -> Aff (Either PGError a)) -> Connection -> m a -> m 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 PG context). If you want to change the transaction mode, issue a separate SET TRANSACTION statement within the transaction.

Re-exports from Database.PostgreSQL

#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

#Query Source

newtype Query i o

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

Constructors

Instances

#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.

#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

#Connection Source

data Connection :: Type

PostgreSQL connection.

#newPool Source

newPool :: PoolConfiguration -> Effect Pool

Create a new connection pool.

Re-exports from Database.PostgreSQL.Row

#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