Let WalkAll use coredata collection slice types

WalkAll now accepts loaders and callbacks typed as S ~[]T so
exports can use AuditLogEntries and SCIMEvents directly. Pass the
trimmed page slice to walk, not the over-fetched loader result.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
Cursor Agent
2026-07-29 20:40:40 +00:00
parent bff06a3c6d
commit 0132bc78bd
3 changed files with 39 additions and 11 deletions

View File

@@ -212,3 +212,29 @@ func TestWalkAllHasNoPageCap(t *testing.T) {
assert.Equal(t, loadAllValues(store), loadAllValues(got))
assert.Greater(t, fetchs, MaxLoadAllPages)
}
type loadAllItems []*loadAllItem
func TestWalkAllNamedSliceType(t *testing.T) {
t.Parallel()
store := newLoadAllStore(MaxCursorSize + 1)
var got loadAllItems
err := WalkAll(
context.Background(),
ascOrderBy(),
func(_ context.Context, cursor *Cursor[testOrderField]) (loadAllItems, error) {
return loadAllItems(keysetPage(store, cursor)), nil
},
func(rows loadAllItems) error {
got = append(got, rows...)
return nil
},
)
require.NoError(t, err)
require.Len(t, got, len(store))
assert.Equal(t, loadAllValues(store), loadAllValues(got))
}