Storage: Add ascending order support for NotOlderThan queries and introduce ResourceVersionMatch_Unset as default (#102505)

* Add support for ASC ordering and introduce ResourceVersionMatch_Unset as default
Add SortAscending to continue token and add integration test for pagination.

* Change protobuf order

* Make backwards compatible

* Update pkg/storage/unified/sql/backend.go

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
This commit is contained in:
Marco de Abreu
2025-03-21 18:35:32 +02:00
committed by GitHub
co-authored by Jean-Philippe Quéméner Marco de Abreu
parent 7d435e5d84
commit 6d570db312
11 changed files with 1204 additions and 695 deletions
@@ -16,12 +16,20 @@ WHERE 1 = 1
AND {{ .Ident "action" }} = 3
{{ end }}
{{ if (gt .StartRV 0) }}
{{ if .SortAscending }}
AND {{ .Ident "resource_version" }} > {{ .Arg .StartRV }}
{{ else }}
AND {{ .Ident "resource_version" }} < {{ .Arg .StartRV }}
{{ end }}
{{ end }}
{{ if (gt .MinRV 0) }}
AND {{ .Ident "resource_version" }} >= {{ .Arg .MinRV }}
{{ end }}
{{ if (gt .ExactRV 0) }}
AND {{ .Ident "resource_version" }} = {{ .Arg .ExactRV }}
{{ end }}
{{ if .SortAscending }}
ORDER BY resource_version ASC
{{ else }}
ORDER BY resource_version DESC
{{ end }}