pg-store-0.5.0: Simple storage interface to PostgreSQL

Database.PostgreSQL.Store.RowParser

Description

Synopsis

# Row parser

data RowParser w a Source #

Consumes w columns of a result set row in order to produce an instance of a.

Instances

 Source # Methodsfmap :: (a -> b) -> RowParser w a -> RowParser w b #(<$) :: a -> RowParser w b -> RowParser w a # Location of an error Constructors  RowErrorLocation Column Row Instances  Source # Methods Source # Methods Source # MethodsshowList :: [RowErrorLocation] -> ShowS # Errors that occur during row parsing Constructors  TooFewColumns Underlying RowParser wants more columns than are currently present. ColumnRejected A column value could not be parsed. Instances  Source # Methods Source # Methods Source # MethodsshowList :: [RowErrorDetail] -> ShowS # data RowError Source # An error that occured when parsing a row Constructors  RowError RowErrorLocation RowErrorDetail Instances  Source # Methods Source # Methods(<) :: RowError -> RowError -> Bool #(>) :: RowError -> RowError -> Bool # Source # MethodsshowList :: [RowError] -> ShowS # processResultWith :: forall a n. KnownNat n => Result -> RowParser n a -> ExceptT RowError IO [a] Source # Process the each row of the Result with the given RowParser. # 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 RowParsers, 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.

finish :: a -> RowParser 0 a Source #

Terminate the parsing tree by returning the final result.

Terminate the parsing tree with an error.

Skip a number of columns.

Check if the following n columns are not NULL.

# Default parsers

processContent :: (Oid -> Maybe ByteString -> Maybe a) -> RowParser 1 a Source #

Process the contents of a column.

Retrieve a column's type and content.

Retrieve a column's content.