orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Execution.ExecutionResult

Description

Since: 1.0.0.0

Synopsis

Documentation

class ExecutionResult result where Source #

ExecutionResult is a common interface for types that represent a result set returned from the database. For real, live database interactions, the concrete type will be a Result, but the FakeLibPQResult may be useful as well if you are writing custom code for decoding result sets and want to test aspects of the decoding that don't require a real database.

Since: 1.0.0.0

Methods

maxRowNumber :: result -> IO (Maybe Row) Source #

maxColumnNumber :: result -> IO (Maybe Column) Source #

columnName :: result -> Column -> IO (Maybe ByteString) Source #

getValue :: result -> Row -> Column -> IO SqlValue Source #

newtype Column Source #

A trivial wrapper for Int to help keep track of column vs row number.

Since: 1.0.0.0

Constructors

Column Int 

Instances

Instances details
Enum Column Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Num Column Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Eq Column Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Methods

(==) :: Column -> Column -> Bool #

(/=) :: Column -> Column -> Bool #

Ord Column Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

newtype Row Source #

A trivial wrapper for Int to help keep track of column vs row number.

Since: 1.0.0.0

Constructors

Row Int 

Instances

Instances details
Enum Row Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Methods

succ :: Row -> Row #

pred :: Row -> Row #

toEnum :: Int -> Row #

fromEnum :: Row -> Int #

enumFrom :: Row -> [Row] #

enumFromThen :: Row -> Row -> [Row] #

enumFromTo :: Row -> Row -> [Row] #

enumFromThenTo :: Row -> Row -> Row -> [Row] #

Num Row Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Methods

(+) :: Row -> Row -> Row #

(-) :: Row -> Row -> Row #

(*) :: Row -> Row -> Row #

negate :: Row -> Row #

abs :: Row -> Row #

signum :: Row -> Row #

fromInteger :: Integer -> Row #

Eq Row Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Methods

(==) :: Row -> Row -> Bool #

(/=) :: Row -> Row -> Bool #

Ord Row Source #

Since: 1.0.0.0

Instance details

Defined in Orville.PostgreSQL.Execution.ExecutionResult

Methods

compare :: Row -> Row -> Ordering #

(<) :: Row -> Row -> Bool #

(<=) :: Row -> Row -> Bool #

(>) :: Row -> Row -> Bool #

(>=) :: Row -> Row -> Bool #

max :: Row -> Row -> Row #

min :: Row -> Row -> Row #

readRows :: ExecutionResult result => result -> IO [[(Maybe ByteString, SqlValue)]] Source #

Reads the rows of an ExecutionResult as a list of column name, SqlValue pairs. You're almost always better off using a SqlMarshaller instead, but this function is provided for cases where you really want to decode the rows yourself but don't want to use the ExecutionResult API to read each row of each column directly.

Since: 1.0.0.0

data FakeLibPQResult Source #

FakeLibPQResult provides a fake, in-memory implementation of ExecutionResult. This is mostly useful for writing automated tests that can assume a result set has been loaded and you just need to test decoding the results.

Since: 1.0.0.0

mkFakeLibPQResult Source #

Arguments

:: [ByteString]

The column names for the result set

-> [[SqlValue]]

The row data for the result set

-> FakeLibPQResult 

Constructs a FakeLibPQResult. The column names given are associated with the values for each row by their position in-list. Any missing values (e.g. because a row is shorter than the header list) are treated as a SQL Null value.

Since: 1.0.0.0