1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-13 13:59:40 +00:00

Add sorting to partition store

Extend the partition store to parse the "sort" query parameter as a
sorting condition. Dot notation is used to denote the object field.
Preceding the key with "-" denotes descending (reverse) order.

Example sorting by name:

GET /v1/secrets?sort=metadata.name

Reverse sorting by name:

GET /v1/secrets?sort=-metadata.name

All values are converted to strings and sorted lexicographically.
This commit is contained in:
Colleen Murphy
2022-10-27 14:11:17 -07:00
parent f8eaa11d83
commit adecbd9122
4 changed files with 447 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ func (s *Store) List(apiOp *types.APIRequest, schema *types.APISchema) (types.AP
}
list := listprocessor.FilterList(stream, opts.Filters)
list = listprocessor.SortList(list, opts.Sort)
for _, item := range list {
item := item