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:
@@ -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
|
||||
|
Reference in New Issue
Block a user