[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\_aggregate\_context

```ts
function sqlite3_aggregate_context(
  deps: SqliteWasmDep,
): (context: SqliteContextPtr, nBytes: number) => 0 | WasmPtr;
```

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

Returns the state memory of the current aggregate function instance: the
first call allocates nBytes of zeroed memory, later calls return the same
buffer, and SQLite frees it when the aggregate concludes. Returns NULL when
the first call passes nBytes of zero or less or runs out of memory.

Wasm type `i(ii)`. Signature `["sqlite3_aggregate_context", "void*",
"sqlite3_context*", "int"]` from SQLite's table.

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