duckdb-simple-0.1.1.1: Haskell FFI bindings for DuckDB
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

class Function a Source #

Typeclass describing Haskell functions that can be exposed to DuckDB.

Minimal complete definition

argumentTypes, returnType, isVolatile, applyFunction

Instances

Instances details
FunctionResult a => Function a Source # 
Instance details

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 # 
Instance details

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 # 
Instance details

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.