|Maintainer||Janne Hellsten <email@example.com>|
FromField typeclass, for converting a single value in a row
returned by a SQL query into a more useful Haskell representation.
A Haskell numeric type is considered to be compatible with all
SQLite numeric types that are less accurate than it. For instance,
Double type is compatible with the SQLite's 32-bit
Int type because it can represent a
Int exactly. On the other hand,
Double might lose precision if representing a 64-bit
the two are not considered compatible.
- class FromField a where
- type FieldParser a = Field -> Ok a
- data ResultError
- data Field
A type that may be converted from a SQL type.
Convert a SQL value to a Haskell value.
Returns a list of exceptions if the conversion fails. In the case of
library instances, this will usually be a single
may be a
fromField should not retain any references to
Field nor the
ByteString arguments after the result has
been evaluated to WHNF. Such a reference causes the entire
LibPQ. to be retained.
Exception thrown if conversion from a SQL value to a Haskell value fails.
The SQL and Haskell types are not compatible.
The SQL value could not be parsed, or could not be represented as a valid Haskell value, or an unexpected low-level error occurred (e.g. mismatch between metadata and actual data in a row).