| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.DuckDB.Simple.ToField
Description
The ToField class mirrors the interface provided by sqlite-simple while
delegating to the DuckDB C API under the hood.
Synopsis
- data FieldBinding
- class DuckDBColumnType a => ToDuckValue a where
- toDuckValue :: a -> IO DuckDBValue
- class ToField a where
- toField :: a -> FieldBinding
- class DuckDBColumnType a where
- duckdbColumnTypeFor :: Proxy a -> Text
- data NamedParam where
- (:=) :: forall a. ToField a => Text -> a -> NamedParam
- duckdbColumnType :: DuckDBColumnType a => Proxy a -> Text
- bindFieldBinding :: Statement -> DuckDBIdx -> FieldBinding -> IO ()
- renderFieldBinding :: FieldBinding -> String
Documentation
data FieldBinding Source #
Encapsulates the action required to bind a single positional parameter, together with a textual description used in diagnostics.
class DuckDBColumnType a => ToDuckValue a where Source #
Low-level class for values that can be marshalled directly into DuckDBValues.
Methods
toDuckValue :: a -> IO DuckDBValue Source #
Convert a Haskell value into an owned DuckDB boxed value.
Instances
class ToField a where Source #
Types that can be used as positional parameters.
Minimal complete definition
Nothing
Methods
toField :: a -> FieldBinding Source #
default toField :: (Show a, ToDuckValue a) => a -> FieldBinding Source #
Instances
class DuckDBColumnType a where Source #
Types that map to a concrete DuckDB column type when used with ToField.
Methods
duckdbColumnTypeFor :: Proxy a -> Text Source #
Instances
data NamedParam where Source #
Represents a named parameter binding using the := operator.
Constructors
| (:=) :: forall a. ToField a => Text -> a -> NamedParam infixr 3 |
duckdbColumnType :: DuckDBColumnType a => Proxy a -> Text Source #
Report the DuckDB column type that best matches a given ToField instance.
bindFieldBinding :: Statement -> DuckDBIdx -> FieldBinding -> IO () Source #
Apply a FieldBinding to the given statement/index.
renderFieldBinding :: FieldBinding -> String Source #
Render a bound parameter for error reporting.