Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- class ExecutionResult result where
- maxRowNumber :: result -> IO (Maybe Row)
- maxColumnNumber :: result -> IO (Maybe Column)
- columnName :: result -> Column -> IO (Maybe ByteString)
- getValue :: result -> Row -> Column -> IO SqlValue
- newtype Column = Column Int
- newtype Row = Row Int
- readRows :: ExecutionResult result => result -> IO [[(Maybe ByteString, SqlValue)]]
- data FakeLibPQResult
- mkFakeLibPQResult :: [ByteString] -> [[SqlValue]] -> FakeLibPQResult
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
maxRowNumber :: result -> IO (Maybe Row) Source #
maxColumnNumber :: result -> IO (Maybe Column) Source #
columnName :: result -> Column -> IO (Maybe ByteString) Source #
Instances
ExecutionResult FakeLibPQResult Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Execution.ExecutionResult maxRowNumber :: FakeLibPQResult -> IO (Maybe Row) Source # maxColumnNumber :: FakeLibPQResult -> IO (Maybe Column) Source # columnName :: FakeLibPQResult -> Column -> IO (Maybe ByteString) Source # getValue :: FakeLibPQResult -> Row -> Column -> IO SqlValue Source # | |
ExecutionResult Result Source # | Since: 1.0.0.0 |
A trivial wrapper for Int
to help keep track of column vs row number.
Since: 1.0.0.0
A trivial wrapper for Int
to help keep track of column vs row number.
Since: 1.0.0.0
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
Instances
ExecutionResult FakeLibPQResult Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Execution.ExecutionResult maxRowNumber :: FakeLibPQResult -> IO (Maybe Row) Source # maxColumnNumber :: FakeLibPQResult -> IO (Maybe Column) Source # columnName :: FakeLibPQResult -> Column -> IO (Maybe ByteString) Source # getValue :: FakeLibPQResult -> Row -> Column -> IO SqlValue Source # |
:: [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