Documentation ¶
Index ¶
- Variables
- func UnsafeGet(object any, field string) any
- func UnsafeSet(object any, field string, value any)
- type ByOptionsLister
- type DBClient
- type Filter
- type Indexer
- func (i *Indexer) AddIndexers(newIndexers cache.Indexers) error
- func (i *Indexer) AfterUpsert(key string, obj any, tx db.TXClient) error
- func (i *Indexer) ByIndex(indexName, indexedValue string) ([]any, error)
- func (i *Indexer) GetIndexers() cache.Indexers
- func (i *Indexer) Index(indexName string, obj any) ([]any, error)
- func (i *Indexer) IndexKeys(indexName, indexedValue string) ([]string, error)
- func (i *Indexer) ListIndexFuncValues(name string) []string
- type Informer
- type ListOptionIndexer
- type ListOptions
- type Op
- type OrFilter
- type Pagination
- type Sort
- type SortOrder
- type Store
Constants ¶
This section is empty.
Variables ¶
var (
InvalidColumnErr = errors.New("supplied column is invalid")
)
Functions ¶
Types ¶
type ByOptionsLister ¶
type ByOptionsLister interface {
ListByOptions(ctx context.Context, lo ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, string, error)
}
type DBClient ¶
type DBClient interface { BeginTx(ctx context.Context, forWriting bool) (db.TXClient, error) QueryForRows(ctx context.Context, stmt transaction.Stmt, params ...any) (*sql.Rows, error) ReadObjects(rows db.Rows, typ reflect.Type, shouldDecrypt bool) ([]any, error) ReadStrings(rows db.Rows) ([]string, error) ReadInt(rows db.Rows) (int, error) Prepare(stmt string) *sql.Stmt CloseStmt(stmt db.Closable) error }
type Filter ¶
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 Indexer ¶
type Indexer struct { Store // contains filtered or unexported fields }
Indexer is a SQLite-backed cache.Indexer which builds upon Store adding an index table
func NewIndexer ¶
NewIndexer returns a cache.Indexer backed by SQLite for objects of the given example type
func (*Indexer) AddIndexers ¶
AddIndexers adds more indexers to this Store. If you call this after you already have data in the Store, the results are undefined.
func (*Indexer) AfterUpsert ¶
AfterUpsert updates indices of an object
func (*Indexer) ByIndex ¶
ByIndex returns the stored objects whose set of indexed values for the named index includes the given indexed value
func (*Indexer) GetIndexers ¶
GetIndexers returns the indexers
func (*Indexer) Index ¶
Index returns a list of items that match the given object on the index function
func (*Indexer) IndexKeys ¶
IndexKeys returns a list of the Store keys of the objects whose indexed values in the given index include the given indexed value
func (*Indexer) ListIndexFuncValues ¶
ListIndexFuncValues wraps safeListIndexFuncValues and panics in case of I/O errors
type Informer ¶
type Informer struct { ByOptionsLister }
Informer is a SQLite-backed cache.SharedIndexInformer that can execute queries on listprocessor structs
func NewInformer ¶
func NewInformer(client dynamic.ResourceInterface, fields [][]string, transform cache.TransformFunc, gvk schema.GroupVersionKind, db sqlStore.DBClient, shouldEncrypt bool, namespaced bool) (*Informer, error)
NewInformer returns a new SQLite-backed Informer for the type specified by schema in unstructured.Unstructured form using the specified client
func (*Informer) ListByOptions ¶
func (i *Informer) ListByOptions(ctx context.Context, lo ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, string, error)
ListByOptions returns objects according to the specified list options and partitions. Specifically:
- an unstructured list of resources belonging to any of the specified partitions
- the total number of resources (returned list might be a subset depending on pagination options in lo)
- a continue token, if there are more pages after the returned one
- an error instead of all of the above if anything went wrong
type ListOptionIndexer ¶
type ListOptionIndexer struct { *Indexer // contains filtered or unexported fields }
ListOptionIndexer extends Indexer by allowing queries based on ListOption
func NewListOptionIndexer ¶
func NewListOptionIndexer(fields [][]string, s Store, namespaced bool) (*ListOptionIndexer, error)
NewListOptionIndexer returns a SQLite-backed cache.Indexer of unstructured.Unstructured Kubernetes resources of a certain GVK ListOptionIndexer is also able to satisfy ListOption queries on indexed (sub)fields Fields are specified as slices (eg. "metadata.resourceVersion" is ["metadata", "resourceVersion"])
func (*ListOptionIndexer) ListByOptions ¶
func (l *ListOptionIndexer) ListByOptions(ctx context.Context, lo ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, string, error)
ListByOptions returns objects according to the specified list options and partitions. Specifically:
- an unstructured list of resources belonging to any of the specified partitions
- the total number of resources (returned list might be a subset depending on pagination options in lo)
- a continue token, if there are more pages after the returned one
- an error instead of all of the above if anything went wrong
type ListOptions ¶
type ListOptions struct { ChunkSize int Resume string Filters []OrFilter Sort Sort Pagination Pagination }
ListOptions represents the query parameters that may be included in a list request.
type OrFilter ¶
type OrFilter struct {
Filters []Filter
}
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 Pagination ¶
Pagination represents how to return paginated results.
type Sort ¶
type Sort struct { PrimaryField []string SecondaryField []string PrimaryOrder SortOrder SecondaryOrder SortOrder }
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 SortOrder ¶
type SortOrder int
SortOrder represents whether the list should be ascending or descending.