Portability | portable |
---|---|

Stability | experimental |

Maintainer | Chris Done <chrisdone@gmail.com> |

Safe Haskell | None |

The `QueryResults`

typeclass, for converting a row of results
returned by a SQL query into a more useful Haskell representation.

Predefined instances are provided for tuples containing up to ten elements.

- class QueryResults a where
- convertResults :: [Field] -> [Maybe ByteString] -> a

- convertError :: [Field] -> [Maybe ByteString] -> Int -> a

# Documentation

class QueryResults a whereSource

convertResults :: [Field] -> [Maybe ByteString] -> aSource

Convert values from a row into a Haskell collection.

This function will throw a `ResultError`

if conversion of the
collection fails.

Result a => QueryResults (Only a) | |

(Result a, Result b) => QueryResults (a, b) | |

(Result a, Result b, Result c) => QueryResults (a, b, c) | |

(Result a, Result b, Result c, Result d) => QueryResults (a, b, c, d) | |

(Result a, Result b, Result c, Result d, Result e) => QueryResults (a, b, c, d, e) | |

(Result a, Result b, Result c, Result d, Result e, Result f) => QueryResults (a, b, c, d, e, f) | |

(Result a, Result b, Result c, Result d, Result e, Result f, Result g) => QueryResults (a, b, c, d, e, f, g) | |

(Result a, Result b, Result c, Result d, Result e, Result f, Result g, Result h) => QueryResults (a, b, c, d, e, f, g, h) | |

(Result a, Result b, Result c, Result d, Result e, Result f, Result g, Result h, Result i) => QueryResults (a, b, c, d, e, f, g, h, i) | |

(Result a, Result b, Result c, Result d, Result e, Result f, Result g, Result h, Result i, Result j) => QueryResults (a, b, c, d, e, f, g, h, i, j) |

convertError :: [Field] -> [Maybe ByteString] -> Int -> aSource

Throw a `ConversionFailed`

exception, indicating a mismatch
between the number of columns in the `Field`

and row, and the
number in the collection to be converted to.