query

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 4 Imported by: 0

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"
	FieldDogo                = "dogo"

	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, 1)

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

	Page 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 *gin.Context) *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