1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-05 01:12:09 +00:00

Sort-indirect PR broken into smaller parts: part 2/6 - fix the Sort part of ListOptions (#611)

* Move types related to list options and sql queries into their own package.

The problem having these in the informer package is that eventually code
in other packages will need to import `informer` only for constants or types,
but some members of the informer package may already depend on those. Best to
move type definitions into their own simpler package.

* Fix the ListOptions sort field.

Instead of making it a single array-ish field, convert it into a
true array of Sort Directives.  Easier to read, less bending backwards.

* Rebasing (or human error) duplicated 'NewSortList'.
This commit is contained in:
Eric Promislow
2025-04-25 10:15:20 -07:00
committed by GitHub
parent 2b227dbd22
commit 89268ba86b
5 changed files with 144 additions and 128 deletions

View File

@@ -28,7 +28,7 @@ type ListOptions struct {
ChunkSize int
Resume string
Filters []OrFilter
Sort Sort
SortList SortList
Pagination Pagination
}
@@ -57,8 +57,8 @@ type OrFilter struct {
// The order is represented by prefixing the sort key by '-', e.g. sort=-metadata.name.
// e.g. To sort internal clusters first followed by clusters in alpha order: sort=-spec.internal,spec.displayName
type Sort struct {
Fields [][]string
Orders []SortOrder
Fields []string
Order SortOrder
}
type SortList struct {