Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Database.DuckDB.Simple.FromField
Description
Synopsis
- data Field = Field {
- fieldName :: Text
- fieldIndex :: Int
- fieldValue :: FieldValue
- data FieldValue
- = FieldNull
- | FieldInt8 Int8
- | FieldInt16 Int16
- | FieldInt32 Int32
- | FieldInt64 Int64
- | FieldWord8 Word8
- | FieldWord16 Word16
- | FieldWord32 Word32
- | FieldWord64 Word64
- | FieldFloat Float
- | FieldDouble Double
- | FieldText Text
- | FieldBool Bool
- | FieldBlob ByteString
- | FieldDate Day
- | FieldTime TimeOfDay
- | FieldTimestamp LocalTime
- data ResultError
- = Incompatible {
- errSQLType :: Text
- errSQLField :: Text
- errHaskellType :: Text
- errMessage :: Text
- | UnexpectedNull {
- errSQLType :: Text
- errSQLField :: Text
- errHaskellType :: Text
- errMessage :: Text
- | ConversionFailed {
- errSQLType :: Text
- errSQLField :: Text
- errHaskellType :: Text
- errMessage :: Text
- = Incompatible {
- type FieldParser a = Field -> Ok a
- class FromField a where
- fromField :: FieldParser a
- returnError :: forall b. Typeable b => (Text -> Text -> Text -> Text -> ResultError) -> Field -> Text -> Ok b
Documentation
Metadata for a single column in a row.
Constructors
Field | |
Fields
|
Instances
data FieldValue Source #
Internal representation of a column value.
Constructors
Instances
Show FieldValue Source # | |
Defined in Database.DuckDB.Simple.FromField Methods showsPrec :: Int -> FieldValue -> ShowS # show :: FieldValue -> String # showList :: [FieldValue] -> ShowS # | |
FromField FieldValue Source # | |
Defined in Database.DuckDB.Simple.FromField Methods | |
Eq FieldValue Source # | FieldInteger Integer | FieldNatural Natural |
Defined in Database.DuckDB.Simple.FromField |
data ResultError Source #
Exception thrown if conversion from a SQL value to a Haskell value fails.
Constructors
Incompatible | The SQL and Haskell types are not compatible. |
Fields
| |
UnexpectedNull | A SQL |
Fields
| |
ConversionFailed | 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). |
Fields
|
Instances
Exception ResultError Source # | |
Defined in Database.DuckDB.Simple.FromField Methods toException :: ResultError -> SomeException # fromException :: SomeException -> Maybe ResultError # displayException :: ResultError -> String # | |
Show ResultError Source # | |
Defined in Database.DuckDB.Simple.FromField Methods showsPrec :: Int -> ResultError -> ShowS # show :: ResultError -> String # showList :: [ResultError] -> ShowS # | |
Eq ResultError Source # | |
Defined in Database.DuckDB.Simple.FromField |
type FieldParser a = Field -> Ok a Source #
Parser used by FromField
instances and utilities such as
fieldWith
. The supplied Field
contains
column metadata and an already-decoded FieldValue
; callers should return
Ok
on success or Errors
(typically wrapping a ResultError
) when the
conversion fails.
class FromField a where Source #
Types that can be constructed from a DuckDB column.
Methods
fromField :: FieldParser a Source #