query

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 53

Documentation

Index

Constants

View Source
const (
	FieldName                = "name"
	FieldNames               = "names"
	FieldUID                 = "uid"
	FieldCreationTimeStamp   = "creationTimestamp"
	FieldCreateTime          = "createTime"
	FieldLastUpdateTimestamp = "lastUpdateTimestamp"
	FieldUpdateTime          = "updateTime"
	FieldLabel               = "label"
	FieldAnnotation          = "annotation"
	FieldNamespace           = "namespace"
	FieldStatus              = "status"
	FieldOwnerReference      = "ownerReference"
	FieldOwnerKind           = "ownerKind"

	FieldType = "type"
)
View Source
const (
	ParameterName          = "name"
	ParameterLabelSelector = "labelSelector"
	ParameterFieldSelector = "fieldSelector"
	ParameterPage          = "page"
	ParameterLimit         = "limit"
	ParameterOrderBy       = "sortBy"
	ParameterAscending     = "ascending"
)

Variables

Field contains all the query field that can be compared

View Source
var NoPagination = newPagination(-1, 0)

Functions

This section is empty.

Types

type Field

type Field string

type Filter

type Filter struct {
	Field Field
	Value Value
}

type Pagination

type Pagination struct {
	// items per page
	Limit int

	// offset
	Offset int
}

func (*Pagination) GetValidPagination

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

type Query

type Query struct {
	Pagination *Pagination

	// sort result in which field, default to FieldCreationTimeStamp
	SortBy Field

	// sort result in ascending or descending order, default to descending
	Ascending bool

	//
	Filters map[Field]Value

	LabelSelector string
}

Query represents api search terms

func New

func New() *Query

func ParseQueryParameter

func ParseQueryParameter(request *restful.Request) *Query

func (*Query) Selector

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

type Value

type Value string

Jump to

Keyboard shortcuts

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