Storage: Return an iterator from backend List (#91185)

This commit is contained in:
Ryan McKinley
2024-07-31 12:05:59 +03:00
committed by GitHub
parent dd9172e738
commit f804b0baa3
13 changed files with 475 additions and 268 deletions
+1 -14
View File
@@ -114,26 +114,13 @@ func (r sqlResourceReadRequest) Validate() error {
// List
type sqlResourceListRequest struct {
*sqltemplate.SQLTemplate
Request *resource.ListRequest
Response *resource.ResourceWrapper
Request *resource.ListRequest
}
func (r sqlResourceListRequest) Validate() error {
return nil // TODO
}
func (r sqlResourceListRequest) Results() (*resource.ResourceWrapper, error) {
// sqlResourceListRequest is a set-returning query. As such, it
// should not return its *Response, since that will be overwritten in the
// next call to `Scan`, so it needs to return a copy of it. Note, though,
// that it is safe to return the same `Response.Value` since `Scan`
// allocates a new slice of bytes each time.
return &resource.ResourceWrapper{
ResourceVersion: r.Response.ResourceVersion,
Value: r.Response.Value,
}, nil
}
type historyListRequest struct {
ResourceVersion, Limit, Offset int64
Options *resource.ListOptions