Skip to main content
Go to Latest
interface SqliteFunctionOptions
import { type SqliteFunctionOptions } from "https://deno.land/x/sqlite@v3.7.2/mod.ts";

Options for defining a custom SQL function.

Properties

optional
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.

optional
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.

optional
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 https://www.sqlite.org/c3ref/c_deterministic.html#sqlitedirectonly for more information.