pg-store-0.2: Simple storage interface to PostgreSQL

Copyright(c) Ole Krüger 2015-2016
LicenseBSD3
MaintainerOle Krüger <ole@vprsm.de>
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Store.Errand

Contents

Description

 

Synopsis

Errand

data ErrandError Source #

Error during errand

Constructors

NoResult

No Result has been returned.

UserError String

A user has thrown an error.

ExecError ExecStatus ErrorCode ByteString ByteString ByteString

Query execution failed.

ParseError RowError

Result processing failed.

data Errand a Source #

An interaction with the database

Instances

Monad Errand Source # 

Methods

(>>=) :: Errand a -> (a -> Errand b) -> Errand b #

(>>) :: Errand a -> Errand b -> Errand b #

return :: a -> Errand a #

fail :: String -> Errand a #

Functor Errand Source # 

Methods

fmap :: (a -> b) -> Errand a -> Errand b #

(<$) :: a -> Errand b -> Errand a #

Applicative Errand Source # 

Methods

pure :: a -> Errand a #

(<*>) :: Errand (a -> b) -> Errand a -> Errand b #

(*>) :: Errand a -> Errand b -> Errand b #

(<*) :: Errand a -> Errand b -> Errand a #

MonadIO Errand Source # 

Methods

liftIO :: IO a -> Errand a #

MonadError ErrandError Errand Source # 

runErrand :: Connection -> Errand a -> IO (Either ErrandError a) Source #

Run an errand.

execute :: Query a -> Errand Result Source #

Execute a query and return the internal raw result.

execute' :: Query a -> Errand Int Source #

Same as execute but instead of a Result it returns the number of affected rows.

query :: Entity a => Query a -> Errand [a] Source #

Execute a query and process its result set.

queryWith :: Query a -> RowParser a -> Errand [a] Source #

Execute a query and process its result set using the provided RowParser.

insert :: TableEntity a => a -> Errand Bool Source #

Insert a row into a Table.

insertMany :: TableEntity a => [a] -> Errand Int Source #

Insert many rows into a Table.

deleteAll :: TableEntity a => proxy a -> Errand Int Source #

Delete all rows of a Table.

findAll :: TableEntity a => Errand [a] Source #

Find every row of a Table.

create :: TableEntity a => proxy a -> Errand () Source #

Create the given Table type.