pg-store-0.2: Simple storage interface to PostgreSQL

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

Database.PostgreSQL.Store.RowParser

Contents

Description

 

Synopsis

Row Parser

data RowParser a Source #

Row parser

rowNumber :: RowParser Row Source #

Retrieve the current row number.

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.

Result Parser

parseResult :: Result -> RowParser a -> ExceptT RowError IO [a] Source #

Parse the result.