API reference › @evolu/sqlite-wasm › c-api › sqlite3_create_collation_v2
function sqlite3_create_collation_v2(
deps: SqliteWasmDep,
): (
db: SqliteDbPtr,
zName: CStringPtr,
eTextRep: number,
pArg: 0 | WasmPtr,
xCompare: 0 | SqliteFunctionPtr,
xDestroy: 0 | SqliteFunctionPtr,
) => SqliteResultCode;
Defined in: packages/sqlite-wasm/src/CApi.ts:2639
Works like sqlite3_create_collation, and SQLite calls a non-NULL xDestroy with pArg when the collation is replaced or the connection closes. Unlike other SQLite functions, it does not call xDestroy when this call fails, so the caller then disposes of pArg.
Wasm type i(iiiiii). Signature ["sqlite3_create_collation_v2", "int", "sqlite3*", "string", "int", "*", "funcptr:i(pipip)", "funcptr:v(p)"] from
Evolu's supplement: SQLite binds it by hand to accept JavaScript functions as
callbacks.