database.function(name[, options], function)
-
name
<string> 要创建的 SQLite 函数的名称。¥
name
<string> The name of the SQLite function to create. -
options
<Object> 函数的可选配置设置。支持以下属性:¥
options
<Object> Optional configuration settings for the function. The following properties are supported:-
deterministic
<boolean> 如果是true
,则在创建的函数上设置SQLITE_DETERMINISTIC
标志。默认值:false
。¥
deterministic
<boolean> Iftrue
, theSQLITE_DETERMINISTIC
flag is set on the created function. Default:false
. -
directOnly
<boolean> 如果是true
,则在创建的函数上设置SQLITE_DIRECTONLY
标志。默认值:false
。¥
directOnly
<boolean> Iftrue
, theSQLITE_DIRECTONLY
flag is set on the created function. Default:false
. -
useBigIntArguments
<boolean> 如果true
,则function
的整数参数将转换为BigInt
。如果false
,则整数参数作为 JavaScript 数字传递。默认值:false
。¥
useBigIntArguments
<boolean> Iftrue
, integer arguments tofunction
are converted toBigInt
s. Iffalse
, integer arguments are passed as JavaScript numbers. Default:false
. -
varargs
<boolean> 如果true
,function
可以接受可变数量的参数。如果false
,function
必须使用恰好function.length
个参数调用。默认值:false
。¥
varargs
<boolean> Iftrue
,function
can accept a variable number of arguments. Iffalse
,function
must be invoked with exactlyfunction.length
arguments. Default:false
.
-
-
function
<Function> 调用 SQLite 函数时要调用的 JavaScript 函数。¥
function
<Function> The JavaScript function to call when the SQLite function is invoked.
此方法用于创建 SQLite 用户定义函数。此方法是 sqlite3_create_function_v2()
的封装器。
¥This method is used to create SQLite user-defined functions. This method is a
wrapper around sqlite3_create_function_v2()
.