Skip to main content
interface SqliteFunctionOptions
import { type SqliteFunctionOptions } from "";

Options for defining a custom SQL function.


name: string

Name of the custom function to be used on the SQL side.

If this argument is omitted, the function's name is used. E.g.

function foo(...) { ... }
const foo = (...) => ...;
const bar = function foo(...) { ... };

would all be called foo on the SQL side.

deterministic: boolean

Enables additional query optimizations if a function is pure (i.e. if it always returns the same output given the same input).

By default this is assumed false.

directOnly: boolean

If directOnly is true, the SQLITE_DIRECTONLY flag is set when creating the user-defined function.

Setting this flag means the function can only be invoked from top-level SQL (e.g. it can't be used inside VIEWs or TRIGGERs).

This is a security feature that prevents functions to be invoked by malicious inputs to the database / malicious values set in bound parameters.

By default this is assumed true.

See for more information.