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:
1 parent
f0f7e635a0
commit
d4d856e712
10 files changed
+1110
-363
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user