query

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PagingParam                   = "paging"
	ParameterName                 = "name"
	ParameterLabelSelector        = "labelSelector"
	ParameterFieldSelector        = "fieldSelector"
	ParameterContinue             = "continue"
	ParameterLimit                = "limit"
	ParameterWatch                = "watch"
	ParameterAllowWatchBookMark   = "allowWatchBookmarks"
	ParameterResourceVersion      = "resourceVersion"
	ParameterResourceVersionMatch = "resourceVersionMatch"
	ParameterTimeoutSeconds       = "timeoutSeconds"
	ParameterNode                 = "node"
	ParameterOperation            = "operation"
	ParameterStep                 = "step"
	ParameterOffset               = "offset"
	OrderByParam                  = "orderBy"
	ParamReverse                  = "reverse"
	ParamDryRun                   = "dryRun"
	ParamRole                     = "role"
	ParamOffline                  = "offline"
	ParameterSubDomain            = "subdomain"
	ParameterFuzzySearch          = "fuzzy"
	ParameterForce                = "force"
)
View Source
const (
	DefaultLimit      = 10
	DefaultPage       = 1
	MinTimeoutSeconds = 1800
)
View Source
const (
	ResourceVersionMatchNotOlderThan = "NotOlderThan"
	ResourceVersionMatchExact        = "Exact"
)

Variables

View Source
var NoPagination = func() *Pagination {
	return newPagination(-1, 0)
}

Functions

func AtoiOrDefault

func AtoiOrDefault(str string, defVal int) int

func GetBoolValueWithDefault

func GetBoolValueWithDefault(req *restful.Request, name string, dv bool) bool

func GetInt64ValuePointerWithDefault

func GetInt64ValuePointerWithDefault(req *restful.Request, name string, dv int64) *int64

func GetInt64ValueWithDefault

func GetInt64ValueWithDefault(req *restful.Request, name string, dv int64) int64

func GetIntValueWithDefault

func GetIntValueWithDefault(req *restful.Request, name string, dv int) int

func GetStringValueWithDefault

func GetStringValueWithDefault(req *restful.Request, name string, dv string) string

func GetWrapperBoolWithDefault

func GetWrapperBoolWithDefault(req *restful.Request, name string, dv *bool) *bool

func IsInformerRawQuery

func IsInformerRawQuery(req *restful.Request) bool

func ParsePaging

func ParsePaging(req *restful.Request) (limit, offset int)

Types

type Pagination

type Pagination struct {
	Limit  int
	Offset int
}

func (*Pagination) GetValidPagination

func (p *Pagination) GetValidPagination(total int) (startIndex, endIndex int)

type Query

type Query struct {
	Pagination      *Pagination
	TimeoutSeconds  *int64
	ResourceVersion string
	Watch           bool
	LabelSelector   string
	FieldSelector   string
	Continue        string
	Limit           int64
	Reverse         bool
	// TODO: add orderby
	OrderBy              string
	DryRun               string
	AllowWatchBookmarks  bool
	ResourceVersionMatch string
	FuzzySearch          map[string]string
}

Query represents api search terms

func New

func New() *Query

func NewFromRawQuery

func NewFromRawQuery(rawQuery url.Values) *Query

func ParseQueryParameter

func ParseQueryParameter(request *restful.Request) *Query

func (*Query) AddLabelSelector added in v1.4.0

func (q *Query) AddLabelSelector(selectors []string)

AddLabelSelector add labelSelector to query.

func (*Query) DeepCopy added in v1.4.0

func (q *Query) DeepCopy() *Query

DeepCopy copy query.

func (*Query) GetFieldSelector

func (q *Query) GetFieldSelector() fields.Selector

func (*Query) GetLabelSelector

func (q *Query) GetLabelSelector() labels.Selector

func (*Query) HasLabelSelector added in v1.4.0

func (q *Query) HasLabelSelector(selector string) bool

HasLabelSelector check label is exist

Jump to

Keyboard shortcuts

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