Copyright | (c) Ole Krüger 2016 |
---|---|
License | BSD3 |
Maintainer | Ole Krüger <ole@vprsm.de> |
Safe Haskell | None |
Language | Haskell2010 |
- data RowParser w a
- data RowErrorLocation = RowErrorLocation Column Row
- data RowErrorDetail
- data RowError = RowError RowErrorLocation RowErrorDetail
- processResultWith :: forall a n. KnownNat n => Result -> RowParser n a -> ExceptT RowError IO [a]
- (>>=$) :: forall a v b w. KnownNat v => RowParser v a -> (a -> RowParser w b) -> RowParser (v + w) b
- (>>$) :: forall a v b w. KnownNat v => RowParser v a -> RowParser w b -> RowParser (v + w) b
- (<*>$) :: forall a v b w. KnownNat v => RowParser v (a -> b) -> RowParser w a -> RowParser (v + w) b
- finish :: a -> RowParser 0 a
- cancel :: RowErrorDetail -> RowParser 0 a
- skipColumns :: RowParser n ()
- nonNullCheck :: Int -> RowParser 0 Bool
- processContent :: (Oid -> Maybe ByteString -> Maybe a) -> RowParser 1 a
- retrieveColumn :: RowParser 1 (Oid, Maybe ByteString)
- retrieveContent :: RowParser 1 ByteString
Row parser
Consumes w
columns of a result set row in order to produce an instance of a
.
data RowErrorLocation Source #
Location of an error
data RowErrorDetail Source #
Errors that occur during row parsing
TooFewColumns | Underlying |
ColumnRejected | A column value could not be parsed. |
An error that occured when parsing a row
processResultWith :: forall a n. KnownNat n => Result -> RowParser n a -> ExceptT RowError IO [a] Source #
Means of composition
(>>=$) :: forall a v b w. KnownNat v => RowParser v a -> (a -> RowParser w b) -> RowParser (v + w) b infixl 1 Source #
Transform the result of another RowParser
. Similar to monadic bind. Also keeps track
of how many columns are needed in total.
(>>$) :: forall a v b w. KnownNat v => RowParser v a -> RowParser w b -> RowParser (v + w) b infixl 1 Source #
Chain two RowParser
s, but discard the result of the first.
(<*>$) :: forall a v b w. KnownNat v => RowParser v (a -> b) -> RowParser w a -> RowParser (v + w) b infixl 4 Source #
Just like the '(*)' operator.
cancel :: RowErrorDetail -> RowParser 0 a Source #
Terminate the parsing tree with an error.
skipColumns :: RowParser n () Source #
Skip a number of columns.
Default parsers
processContent :: (Oid -> Maybe ByteString -> Maybe a) -> RowParser 1 a Source #
Process the contents of a column.
retrieveColumn :: RowParser 1 (Oid, Maybe ByteString) Source #
Retrieve a column's type and content.
retrieveContent :: RowParser 1 ByteString Source #
Retrieve a column's content.