mirror of
https://github.com/rancher/steve.git
synced 2025-09-08 02:39:26 +00:00
[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>
This commit is contained in:
59
pkg/sqlcache/informer/listoptions.go
Normal file
59
pkg/sqlcache/informer/listoptions.go
Normal file
@@ -0,0 +1,59 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user