filter

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Labels      = "labels"
	Annotations = "annotations"
)

Variables

This section is empty.

Functions

func ConvertHandler added in v1.7.3

func ConvertHandler(items []unstructured.Unstructured, param *ConvertParam) ([]unstructured.Unstructured, error)

func ConvertListToUnstructured added in v1.9.0

func ConvertListToUnstructured(list interface{}) (unstructured.Unstructured, error)

func ExactFilter added in v1.7.3

func ExactFilter(items []unstructured.Unstructured, exact map[string]sets.Set[string]) ([]unstructured.Unstructured, error)

func FuzzyFilter added in v1.7.3

func FuzzyFilter(items []unstructured.Unstructured, fuzzy map[string][]string) ([]unstructured.Unstructured, error)

func GetDeepFloat64

func GetDeepFloat64(item unstructured.Unstructured, keyStr string) (value float64)

GetDeepFloat64 get float64 value by metadata.xx.xx.xx, multi level key

func GetDeepValue

func GetDeepValue(item interface{}, keyStr string) ([]string, error)

GetDeepValue get value by metadata.xx.xx.xx, multi level key

func PageHandler added in v1.7.3

func PageHandler(items []unstructured.Unstructured, limit int, offset int) ([]unstructured.Unstructured, error)

func ParseJsonDataHandler added in v1.7.3

func ParseJsonDataHandler(data []byte) (unstructuredObj *unstructured.Unstructured, err error)

func SetDecoder added in v1.7.6

func SetDecoder(scheme *runtime.Scheme)

func SortHandler added in v1.7.3

func SortHandler(items []unstructured.Unstructured, param *SortParam) ([]unstructured.Unstructured, error)

Types

type Condition added in v1.7.3

type Condition struct {
	Exact     map[string]sets.Set[string]
	Fuzzy     map[string][]string
	Limit     int
	Offset    int
	SortName  string
	SortOrder string
	SortFunc  string
}

func PageFilterOption added in v1.7.3

func PageFilterOption(limit int, offset int) *Condition

type ConvertParam added in v1.7.3

type ConvertParam struct {
	// contains filtered or unexported fields
}

type ConverterContext

type ConverterContext struct {
	EnableConvert bool
	RawGvr        *schema.GroupVersionResource
	ConvertedGvr  *schema.GroupVersionResource
	Converter     *conversion.VersionConverter
}

type Filter

type Filter struct {
	Scheme *runtime.Scheme
	// ConverterContext holds methods to convert objects
	*ConverterContext
}

Filter is the filter condition

func GetEmptyFilter added in v1.7.3

func GetEmptyFilter() *Filter

func NewFilter added in v1.7.3

func NewFilter(
	ctx *ConverterContext,
	installFunc ...InstallFunc) *Filter

func (*Filter) FilterObjectList added in v1.7.3

func (f *Filter) FilterObjectList(object runtime.Object, filterCondition *Condition) (int, error)

func (*Filter) ModifyResponse

func (f *Filter) ModifyResponse(r *http.Response, filterCondition *Condition) error

ModifyResponse modify the response

type InstallFunc added in v1.7.3

type InstallFunc func(scheme *runtime.Scheme)

type PageBean added in v1.7.3

type PageBean struct {
	Total int         `json:"total"`
	Items interface{} `json:"items"`
}

type SortParam added in v1.7.3

type SortParam struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL