[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › [c-api](https://evolu.dev/docs/api-reference/sqlite-wasm/c-api) › sqlite3\_create\_function

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

Defined in: [packages/sqlite-wasm/src/CApi.ts:2570](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/CApi.ts#L2570)

Adds, redefines or, with xFunc, xStep and xFinal all NULL, removes an SQL
function of the connection: xFunc implements a scalar function, xStep with
xFinal an aggregate. nArg is the argument count or -1 for any, and eTextRep
the preferred text encoding, optionally with flags such as
SQLITE_DETERMINISTIC and SQLITE_DIRECTONLY.

Wasm type `i(iiiiiiii)`. Signature `["sqlite3_create_function", "int",
"sqlite3*", "string", "int", "int", "*", "funcptr:v(pip)", "funcptr:v(pip)",
"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.