Client cache API paging (#5107)

* internal/clientcache: add -force-reset-schema flag

* clientcache: stream list pages directly to DB

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
(cherry picked from commit ccea8a4ce53f7b0d1105c1c1e4875e443635d96a)
This commit is contained in:
Irena Rindos authored and Timothy Messier committed 2024-09-24 14:18:53 +00:00
1 parent 3a4ee032d9
commit 2945692bf4
54 files changed
+793 -397

No files matched your search

+12 -2
View File
@@ -324,7 +324,12 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*User
opts, apiOpts := getOpts(opt...)
opts.queryMap["scope_id"] = scopeId
req, err := c.client.NewRequest(ctx, "GET", "users", nil, apiOpts...)
requestPath := "users"
if opts.withResourcePathOverride != "" {
requestPath = opts.withResourcePathOverride
}
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating List request: %w", err)
}
@@ -480,7 +485,12 @@ func (c *Client) ListNextPage(ctx context.Context, currentPage *UserListResult,
opts.queryMap["page_size"] = strconv.FormatUint(uint64(currentPage.pageSize), 10)
}
req, err := c.client.NewRequest(ctx, "GET", "users", nil, apiOpts...)
requestPath := "users"
if opts.withResourcePathOverride != "" {
requestPath = opts.withResourcePathOverride
}
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating List request: %w", err)
}