1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-18 06:08:02 +00:00
steve/pkg/sqlcache/informer/listoptions.go
Tom Lebreux 9741028761
[v0.3] Migrate SQL cache to Steve (#474)
* Migrate SQLcache to Steve

* Fix imports

* go mod tidy

* Fix lint errors

* Remove lasso SQL cache mentions

* Fix more CI lint errors

* fix goimports

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* Fix more linting errors

* More lint fix

* Add envtest support

---------

Signed-off-by: Silvio Moioli <silvio@moioli.net>
Co-authored-by: Silvio Moioli <silvio@moioli.net>
2025-02-04 12:41:59 -05:00

60 lines
1.5 KiB
Go

package informer
type Op string
const (
Eq Op = ""
NotEq Op = "!="
)
// SortOrder represents whether the list should be ascending or descending.
type SortOrder int
const (
// ASC stands for ascending order.
ASC SortOrder = iota
// DESC stands for descending (reverse) order.
DESC
)
// ListOptions represents the query parameters that may be included in a list request.
type ListOptions struct {
ChunkSize int
Resume string
Filters []OrFilter
Sort Sort
Pagination Pagination
}
// Filter represents a field to filter by.
// A subfield in an object is represented in a request query using . notation, e.g. 'metadata.name'.
// The subfield is internally represented as a slice, e.g. [metadata, name].
type Filter struct {
Field []string
Match string
Op Op
Partial bool
}
// OrFilter represents a set of possible fields to filter by, where an item may match any filter in the set to be included in the result.
type OrFilter struct {
Filters []Filter
}
// Sort represents the criteria to sort on.
// The subfield to sort by is represented in a request query using . notation, e.g. 'metadata.name'.
// The subfield is internally represented as a slice, e.g. [metadata, name].
// The order is represented by prefixing the sort key by '-', e.g. sort=-metadata.name.
type Sort struct {
PrimaryField []string
SecondaryField []string
PrimaryOrder SortOrder
SecondaryOrder SortOrder
}
// Pagination represents how to return paginated results.
type Pagination struct {
PageSize int
Page int
}