dataselector

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataSelectPage

func DataSelectPage(dataList []DataCell, q *common.QueryParam) *common.Page

GenericDataSelect takes a list of GenericDataCells and DataSelectQuery and returns selected data as instructed by dsQuery.

Types

type ComparableValue

type ComparableValue interface {
	// Compares self with other value. Returns 1 if other value is smaller, 0 if they are the same, -1 if other is larger.
	Compare(ComparableValue) int
	// Returns true if self value contains or is equal to other value, false otherwise.
	Contains(ComparableValue) bool
}

ComparableValue hold any value that can be compared to its own kind.

func ParseToComparableValue

func ParseToComparableValue(value interface{}) ComparableValue

type DataCell

type DataCell interface {
	// GetPropertyAtIndex returns the property of this data cell.
	// Value returned has to have Compare method which is required by Sort functionality of DataSelect.
	GetProperty(PropertyName) ComparableValue
}

GenericDataCell describes the interface of the data cell that contains all the necessary methods needed to perform complex data selection GenericDataSelect takes a list of these interfaces and performs selection operation. Therefore as long as the list is composed of GenericDataCells you can perform any data selection!

type DataSelector

type DataSelector struct {
	// GenericDataList hold generic data cells that are being selected.
	GenericDataList []DataCell
	// DataSelectQuery holds instructions for data select.
	DataSelectQuery *common.QueryParam
}

SelectableData contains all the required data to perform data selection. It implements sort.Interface so its sortable under sort.Sort You can use its Select method to get selected GenericDataCell list.

func (*DataSelector) Filter

func (self *DataSelector) Filter() *DataSelector

Filter the data inside as instructed by DataSelectQuery and returns itself to allow method chaining.

func (DataSelector) Len

func (self DataSelector) Len() int

Len returns the length of data inside SelectableData.

func (DataSelector) Less

func (self DataSelector) Less(i, j int) bool

Less compares 2 indices inside SelectableData and returns true if first index is larger.

func (*DataSelector) Sort

func (self *DataSelector) Sort() *DataSelector

Sort sorts the data inside as instructed by DataSelectQuery and returns itself to allow method chaining.

func (DataSelector) Swap

func (self DataSelector) Swap(i, j int)

Swap swaps 2 indices inside SelectableData.

type PropertyName

type PropertyName string

PropertyName is used to get the value of certain property of data cell. For example if we want to get the namespace of certain Deployment we can use DeploymentCell.GetProperty(NamespaceProperty)

const (
	NameProperty              PropertyName = "name"
	CreationTimestampProperty PropertyName = "creationTimestamp"
	NamespaceProperty         PropertyName = "namespace"
	StatusProperty            PropertyName = "status"

	// Pod Property
	PodIPProperty    PropertyName = "podIP"
	NodeNameProperty PropertyName = "nodeName"
)

List of all property names supported by the UI.

type StdComparableInt

type StdComparableInt int

func (StdComparableInt) Compare

func (self StdComparableInt) Compare(otherV ComparableValue) int

func (StdComparableInt) Contains

func (self StdComparableInt) Contains(otherV ComparableValue) bool

type StdComparableString

type StdComparableString string

func (StdComparableString) Compare

func (self StdComparableString) Compare(otherV ComparableValue) int

func (StdComparableString) Contains

func (self StdComparableString) Contains(otherV ComparableValue) bool

type StdComparableTime

type StdComparableTime time.Time

func (StdComparableTime) Compare

func (self StdComparableTime) Compare(otherV ComparableValue) int

func (StdComparableTime) Contains

func (self StdComparableTime) Contains(otherV ComparableValue) bool

Jump to

Keyboard shortcuts

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