Module

Droplet.Driver

Package
purescript-droplet
Repository
easafe/purescript-droplet

Functions for database access

Re-exports from Droplet.Driver.Internal.Pool

#Pool Source

data Pool :: Type

PostgreSQL connection pool.

#Database Source

#Configuration Source

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

PostgreSQL connection pool configuration.

#newPool Source

newPool :: Configuration -> Effect Pool

Create a new connection pool.

Re-exports from Droplet.Driver.Internal.Query

#PGErrorDetail Source

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

#Connection Source

newtype Connection

Instances

#FromResult Source

class FromResult :: RowList Type -> Type -> Constraintclass FromResult (projection :: RowList Type) result | projection -> result where

Members

Instances

#withTransaction Source

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

Runs queries within a transaction

#withConnection Source

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

Runs queries with a connection

#single Source

single :: forall q projection pro. ToQuery q projection => RowToList projection pro => FromResult pro (Record projection) => Connection -> q -> Aff (Either PgError (Maybe (Record projection)))

Runs a query that returns zero or one results

#query Source

query :: forall q projection pro. ToQuery q projection => RowToList projection pro => FromResult pro (Record projection) => Connection -> q -> Aff (Either PgError (Array (Record projection)))

Returns an array of projection records

#execute Source

execute :: forall q. ToQuery q () => Connection -> q -> Aff (Maybe PgError)

Runs a query without results

Re-exports from Droplet.Language.Internal.Translate

#Query Source

data Query :: Row Type -> Typedata Query (projection :: Row Type)

Instances