API reference › @evolu/sqlite-wasm › c-api › sqlite3_create_function_v2

function sqlite3_create_function_v2(
  deps: SqliteWasmDep,
): (
  db: SqliteDbPtr,
  zFunctionName: CStringPtr,
  nArg: number,
  eTextRep: number,
  pApp: 0 | WasmPtr,
  xFunc: 0 | SqliteFunctionPtr,
  xStep: 0 | SqliteFunctionPtr,
  xFinal: 0 | SqliteFunctionPtr,
  xDestroy: 0 | SqliteFunctionPtr,
) => SqliteResultCode;

Defined in: packages/sqlite-wasm/src/CApi.ts:2587

Works like sqlite3_create_function, and SQLite calls a non-NULL xDestroy with pApp when the function is redefined or removed, when the connection closes, and when this call fails.

Wasm type i(iiiiiiiii). Signature ["sqlite3_create_function_v2", "int", "sqlite3*", "string", "int", "int", "*", "funcptr:v(pip)", "funcptr:v(pip)", "funcptr:v(p)", "funcptr:v(p)"] from Evolu's supplement: SQLite binds it by hand to accept JavaScript functions as callbacks.

See https://sqlite.org/c3ref/create_function.html.