internal/target: refactor for new pagination design

The new design uses four separate service functions; List,
ListPage, ListRefresh and ListRefreshPage. The first two are
used during the initial pagination phase and the latter two
are used for any subsequent refresh phases.
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:20 -08:00
1 parent f0f7e635a0
commit d4d856e712
10 files changed
+1110 -363

No files matched your search

+10 -3
View File
@@ -76,10 +76,17 @@ func TestTargetAddress(t testing.TB, conn *db.DB, targetId, address string) *Add
}
// TestListTargets exposes the repo listTargets method for testing purposes.
func TestListTargets(t testing.TB, repo *Repository, ctx context.Context, opts ...Option) []Target {
targets, err := repo.listTargets(ctx, opts...)
func TestListTargets(t testing.TB, repo *Repository, ctx context.Context, opts ...Option) ([]Target, time.Time) {
targets, ttime, err := repo.listTargets(ctx, opts...)
require.NoError(t, err)
return targets
return targets, ttime
}
// TestListTargetsRefresh exposes the repo listTargetsRefresh method for testing purposes.
func TestListTargetsRefresh(t testing.TB, repo *Repository, ctx context.Context, updateAfter time.Time, opts ...Option) ([]Target, time.Time) {
targets, ttime, err := repo.listTargetsRefresh(ctx, updateAfter, opts...)
require.NoError(t, err)
return targets, ttime
}
// TestListDeletedIds exposes the repo listDeletedIds method for testing purposes.