+34
−7
pagination_example_test.go
0 → 100644
+42
−0
+29
−0
Loading
Introduce `ScanAndCollectN`, which works like `ScanAndCollect` but stops collecting once _n_ items have been gathered. Negative values of _n_ retain the existing "collect all" behaviour, allowing `ScanAndCollect` to delegate to it. This allows capping search results before they overwhelm callers. Add an example function demonstrating how to use `ScanAndCollectN` with a note directing users toward `Scan2` when iteration is preferred over collecting into a slice.