| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Database.DuckDB.Simple.Function
Description
This module mirrors the high-level API provided by sqlite-simple for user
defined functions, adapted to DuckDB's chunked execution model. It allows
pure and IO-based Haskell functions to be exposed to SQL while reusing the
existing FromField and ToField-style typeclass machinery for argument
decoding and result marshalling.
Synopsis
- class Function a
- createFunction :: forall f. Function f => Connection -> Text -> f -> IO ()
- deleteFunction :: Connection -> Text -> IO ()
Documentation
Typeclass describing Haskell functions that can be exposed to DuckDB.
Minimal complete definition
argumentTypes, returnType, isVolatile, applyFunction
Instances
| FunctionResult a => Function a Source # | |
Defined in Database.DuckDB.Simple.Function Methods argumentTypes :: Proxy a -> [DuckDBType] returnType :: Proxy a -> ScalarType isVolatile :: Proxy a -> Bool applyFunction :: [Field] -> a -> IO ScalarValue | |
| FunctionResult a => Function (IO a) Source # | |
Defined in Database.DuckDB.Simple.Function Methods argumentTypes :: Proxy (IO a) -> [DuckDBType] returnType :: Proxy (IO a) -> ScalarType isVolatile :: Proxy (IO a) -> Bool applyFunction :: [Field] -> IO a -> IO ScalarValue | |
| (FromField a, FunctionArg a, Function r) => Function (a -> r) Source # | |
Defined in Database.DuckDB.Simple.Function Methods argumentTypes :: Proxy (a -> r) -> [DuckDBType] returnType :: Proxy (a -> r) -> ScalarType isVolatile :: Proxy (a -> r) -> Bool applyFunction :: [Field] -> (a -> r) -> IO ScalarValue | |
createFunction :: forall f. Function f => Connection -> Text -> f -> IO () Source #
Register a Haskell function under the supplied name.
deleteFunction :: Connection -> Text -> IO () Source #
Drop a previously registered scalar function by issuing a DROP FUNCTION statement.