Module

Droplet.Driver.Internal.Query

Package
purescript-droplet
Repository
easafe/purescript-droplet

#FromResult Source

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

Members

Instances

#Connection Source

newtype Connection

Constructors

Instances

#Client Source

data Client

PostgreSQL connection.

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

#execute Source

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

Runs a query without 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

#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

#unsafeExecute Source

unsafeExecute :: forall parameters pra. RowToList parameters pra => ToParameters parameters pra => Connection -> Maybe Plan -> String -> Record parameters -> Aff (Maybe PgError)

Runs a query without results from a SQL string

#unsafeQuery Source

unsafeQuery :: forall projection pro parameters pra. RowToList projection pro => RowToList parameters pra => ToParameters parameters pra => FromResult pro (Record projection) => Connection -> Maybe Plan -> String -> Record parameters -> Aff (Either PgError (Array (Record projection)))

Returns an array of projection records from a SQL string

#unsafeSingle Source

unsafeSingle :: forall parameters pra projection pro. RowToList parameters pra => ToParameters parameters pra => RowToList projection pro => FromResult pro (Record projection) => Connection -> Maybe Plan -> String -> Record parameters -> Aff (Either PgError (Maybe (Record projection)))

Runs a query that returns zero or one results from a SQL string

#withConnection Source

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

Runs queries with a connection

#withTransaction Source

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

Runs queries within a transaction