| Copyright | (c) Ole Krüger 2016 |
|---|---|
| License | BSD3 |
| Maintainer | Ole Krüger <ole@vprsm.de> |
| Safe Haskell | None |
| Language | Haskell2010 |
Database.PostgreSQL.Store.RowParser
Contents
Description
- data RowParser a
- data RowErrorLocation = RowErrorLocation Column Row
- data RowErrorDetail
- data RowError = RowError RowErrorLocation RowErrorDetail
- rowNumber :: RowParser Row
- columnNumber :: RowParser Column
- columnsLeft :: RowParser Column
- fetchColumn :: RowParser TypedValue
- peekColumn :: RowParser TypedValue
- parseColumn :: (TypedValue -> Maybe a) -> RowParser a
- peekContents :: RowParser (Maybe ByteString)
- fetchContents :: RowParser (Maybe ByteString)
- parseContents :: (ByteString -> Maybe a) -> RowParser a
- skipColumn :: RowParser ()
- parseResult :: Result -> RowParser a -> ExceptT RowError IO [a]
Row Parser
Row parser
data RowErrorDetail Source #
Errors that occur during row parsing
Constructors
| TooFewColumns | Underlying |
| ColumnRejected TypedValue | A column value could not be parsed. |
| ContentsRejected (Maybe ByteString) | The contents of a column could not be parsed. |
Instances
An error that occured when parsing a row.
Constructors
| RowError RowErrorLocation RowErrorDetail |
columnNumber :: RowParser Column Source #
Retrieve the current column number.
columnsLeft :: RowParser Column Source #
Retrieve the number of columns left.
fetchColumn :: RowParser TypedValue Source #
Fetch the type Oid and value of the current cell. Also advances the cell cursor to the next
column.
peekColumn :: RowParser TypedValue Source #
Fetch the TypedValue associated with the current cell without advancing the cursor.
parseColumn :: (TypedValue -> Maybe a) -> RowParser a Source #
Fetch a column and parse it. Returning Nothing from the provided parser function will cause
a ColumnRejected to be raised. Advances the cell cursor to the next column.
peekContents :: RowParser (Maybe ByteString) Source #
Fetch the cell's contents without moving the cell cursor.
fetchContents :: RowParser (Maybe ByteString) Source #
Like peekContents but moves the cell cursor to the next column.
parseContents :: (ByteString -> Maybe a) -> RowParser a Source #
Parse the contents of a column (only if present). Returning Nothing from the provided parser
function will raise a ContentsRejected. When the cell is NULL, a ContentsRejected is raised
aswell.
skipColumn :: RowParser () Source #
Point cursor to the next column.