Skip to content

Add entity-aware chunk queries - #342

Open
elpete wants to merge 1 commit into
nextfrom
feat/52-chunk-entities
Open

Add entity-aware chunk queries#342
elpete wants to merge 1 commit into
nextfrom
feat/52-chunk-entities

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #52

Issue review

Recommendation: 9/10 — implement. Chunking lets applications process large result sets with bounded memory while retaining Quick’s entity behavior. qb already provides reliable pagination mechanics, so Quick only needs to supply its hydration and transformation layer. The tradeoff is offset-based pagination: rows changing during processing can shift between chunks, so callers doing concurrent mutation may prefer a future key-based chunk API.

Implementation

  • adds QuickBuilder.chunk(max, callback, options)
  • hydrates qb rows into Quick entities before invoking the callback
  • returns the entity’s configured collection type for every chunk
  • applies eager loading and asQuery/asMemento transformations consistently
  • stops when the callback returns false
  • returns the Quick builder for chaining
  • inherits qb’s validation that chunk size must be greater than zero

Test-first evidence

The public regression initially errored because the callback received raw structs and getId() was unavailable. It now receives loaded entities in two-item chunks, verifies ordering, stops after two callbacks, and confirms the returned object is a Quick builder.

Validation

  • focused GetSpec: 35 passed, 0 failed, 0 errors
  • full Lucee 6 suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check

Uses qb@14.0.0-beta.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant