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

function sqlite3_create_collation(
  deps: SqliteWasmDep,
): (
  db: SqliteDbPtr,
  zName: CStringPtr,
  eTextRep: number,
  pArg: 0 | WasmPtr,
  xCompare: 0 | SqliteFunctionPtr,
) => SqliteResultCode;

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

Adds, replaces or, with a NULL xCompare, removes a collation named zName for text in the eTextRep encoding. xCompare(pArg, n1, s1, n2, s2) compares two strings of the given byte lengths and returns a negative number, zero or a positive number; SQLite behavior is undefined when the comparison is inconsistent.

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

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