[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\_collation

```ts
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](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/CApi.ts#L2621)

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.