Storage: Add List support for pagination (#87093)

* Add origin keys to List request
* Check origin keys requirement in the sql entity server's List method
* Refactor mode 2 List
* Check origin keys before making Storage List call

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
This commit is contained in:
Arati R
2024-05-01 08:42:47 +02:00
committed by GitHub
co-authored by Dan Cech
parent 406fe8c85a
commit 61f3d08c3f
7 changed files with 209 additions and 154 deletions
@@ -1300,6 +1300,12 @@ func (s *sqlEntityServer) List(ctx context.Context, r *entity.EntityListRequest)
rvSubQuery.AddWhere("("+strings.Join(where, " OR ")+")", args...)
}
if len(r.OriginKeys) > 0 {
entityQuery.AddWhereIn("origin_key", ToAnyList(r.OriginKeys))
rvMaxQuery.AddWhereIn("origin_key", ToAnyList(r.OriginKeys))
rvSubQuery.AddWhereIn("origin_key", ToAnyList(r.OriginKeys))
}
// get the maximum resource version and count of entities
type RVMaxRow struct {
Rv int64 `db:"rv"`