Skip to content

chunkedInQuery

chunkedInQuery<T>(connection, values, buildSoql, options): Promise<T[]>

Defined in: packages/simply-core/src/query/chunkedInQuery.ts:55

Run a SOQL query once per chunk of values, splicing each chunk into a quoted, comma-joined IN (...) clause, and return every record from every chunk.

SOQL statements are length-limited, so any query filtering on a caller-supplied list has to be split. That splitting — chunk, quote, join, query, accumulate — is the same everywhere; only the query text and the chunk size differ.

T

Connection

The org connection to query against.

readonly string[]

The values to filter on. Quoted and escaped for you; pass them raw.

(inClause) => string

Builds the query for one chunk, given the ready-to-use IN clause body (e.g. (clause) => `SELECT Id FROM Account WHERE Name IN (${clause})` ).

ChunkedInQueryOptions

Chunk size, and whether to use the Tooling API or tolerate failures.

Promise<T[]>

Every record returned across all chunks, in chunk order. Empty if values is empty.