dataselect

package
v0.0.0-...-57c84ca Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameProperty              = "name"
	CreationTimestampProperty = "creationTimestamp"
	NamespaceProperty         = "namespace"
	StatusProperty            = "status"
	SecretTypeProperty        = "type"
	PVCUnusedProperty         = "unused"
	ServiceTypeProperty       = "type"
)

Variables

This section is empty.

Functions

func FromCells

func FromCells(cells []DataCell, list IList)

func ToResourceList

func ToResourceList(list IList, data interface{}, cellConvertF convertF, dsQuery *DataSelectQuery) error

Types

type ChartDataCell

type ChartDataCell struct {
	Chart *api.ChartResult
}

func (ChartDataCell) GetObject

func (cell ChartDataCell) GetObject() interface{}

func (ChartDataCell) GetProperty

func (cell ChartDataCell) GetProperty(name PropertyName) ComparableValue

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
}

type DataCell

type DataCell interface {
	GetProperty(PropertyName) ComparableValue
	// Return the origin wrappered data
	GetObject() interface{}
}

func NewChartDataCell

func NewChartDataCell(obj interface{}) (DataCell, error)

func NewHelmReleaseDataCell

func NewHelmReleaseDataCell(obj interface{}) (DataCell, error)

func NewNamespaceDataCell

func NewNamespaceDataCell(obj interface{}) (DataCell, error)

func NewNamespacePodStatusDataCell

func NewNamespacePodStatusDataCell(obj interface{}) (DataCell, error)

func NewPVCDataCell

func NewPVCDataCell(obj interface{}) (DataCell, error)

func NewResourceDataCell

func NewResourceDataCell(obj interface{}) (DataCell, error)

func NewSecretDataCell

func NewSecretDataCell(obj interface{}) (DataCell, error)

func NewServiceDataCell

func NewServiceDataCell(obj interface{}) (DataCell, error)

func ToCells

func ToCells(data interface{}, cf convertF) ([]DataCell, error)

type DataSelectQuery

type DataSelectQuery struct {
	SortQuery   *SortQuery
	FilterQuery *FilterQuery
	LimitQuery  *LimitQuery
	OffsetQuery *OffsetQuery
}

func DefaultDataSelect

func DefaultDataSelect() *DataSelectQuery

func NewDataSelectQuery

func NewDataSelectQuery(
	sortQuery *SortQuery,
	filterQuery *FilterQuery,
	limitQuery *LimitQuery,
	offsetQuery *OffsetQuery,
) *DataSelectQuery

func NoDataSelect

func NoDataSelect() *DataSelectQuery

type DataSelector

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

func GenericDataSelector

func GenericDataSelector(dataList []DataCell, dsQuery *DataSelectQuery) *DataSelector

func (*DataSelector) Data

func (s *DataSelector) Data() []DataCell

func (*DataSelector) Filter

func (s *DataSelector) Filter() *DataSelector

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

func (DataSelector) Len

func (s DataSelector) Len() int

Len returns the length of data inside SelectableData

func (DataSelector) Less

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

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

func (*DataSelector) Limit

func (s *DataSelector) Limit() *DataSelector

func (*DataSelector) ListMeta

func (s *DataSelector) ListMeta() api.ListMeta

func (*DataSelector) Offset

func (s *DataSelector) Offset() *DataSelector

func (*DataSelector) Sort

func (s *DataSelector) Sort() *DataSelector

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

func (DataSelector) Swap

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

Swap swaps 2 indices inside SelectableData

type FilterBy

type FilterBy struct {
	Property PropertyName
	Value    ComparableValue
}

func NewFilterBy

func NewFilterBy(property, value string) FilterBy

type FilterQuery

type FilterQuery struct {
	FilterByList []FilterBy
}

func NewFilterQuery

func NewFilterQuery(filterByListRaw []string) *FilterQuery

NewFilterQuery takes raw filter options list and returns FilterQuery object. For example: ["paramter1", "value1", "parameter2", "value2"] - means that the data should be filtered by parameter1 equals value1 and parameter2 equals value2

func NoFilter

func NoFilter() *FilterQuery

func (*FilterQuery) Append

func (f *FilterQuery) Append(filters ...FilterBy) *FilterQuery

type HelmReleaseDataCell

type HelmReleaseDataCell struct {
	Release *release.Release
}

func (HelmReleaseDataCell) GetObject

func (cell HelmReleaseDataCell) GetObject() interface{}

func (HelmReleaseDataCell) GetProperty

func (cell HelmReleaseDataCell) GetProperty(name PropertyName) ComparableValue

type IList

type IList interface {
	Append(obj interface{})
	SetMeta(meta tapi.ListMeta)
}

type LimitQuery

type LimitQuery struct {
	Limit int
}

func NewLimitQuery

func NewLimitQuery(limit int) *LimitQuery

func NoLimiter

func NoLimiter() *LimitQuery

type ListMeta

type ListMeta struct {
	tapi.ListMeta
}

func NewListMeta

func NewListMeta() *ListMeta

func (*ListMeta) SetMeta

func (l *ListMeta) SetMeta(meta tapi.ListMeta)

type NamespaceDataCell

type NamespaceDataCell struct {
	ResourceDataCell
}

func (NamespaceDataCell) GetProperty

func (cell NamespaceDataCell) GetProperty(name PropertyName) ComparableValue

type NamespacePodStatusDataCell

type NamespacePodStatusDataCell struct {
	NamespaceDataCell
	Status v1.PodStatus
}

func (NamespacePodStatusDataCell) GetProperty

type OffsetQuery

type OffsetQuery struct {
	Offset int
}

func NewOffsetQuery

func NewOffsetQuery(offset int) *OffsetQuery

func NoOffset

func NoOffset() *OffsetQuery

type PVCDataCell

type PVCDataCell struct {
	NamespaceDataCell
	Unused string // "true" or "false"
}

func (PVCDataCell) GetProperty

func (cell PVCDataCell) GetProperty(name PropertyName) ComparableValue

type PropertyName

type PropertyName string

type ResourceDataCell

type ResourceDataCell struct {
	ObjectMeta metaV1.ObjectMeta
	Object     interface{}
}

func (ResourceDataCell) GetObject

func (cell ResourceDataCell) GetObject() interface{}

func (ResourceDataCell) GetProperty

func (cell ResourceDataCell) GetProperty(name PropertyName) ComparableValue

type SecretDataCell

type SecretDataCell struct {
	NamespaceDataCell
	Type v1.SecretType
}

func (SecretDataCell) GetProperty

func (cell SecretDataCell) GetProperty(name PropertyName) ComparableValue

type ServiceDataCell

type ServiceDataCell struct {
	NamespaceDataCell
	Type v1.ServiceType
}

func (ServiceDataCell) GetProperty

func (cell ServiceDataCell) GetProperty(name PropertyName) ComparableValue

type SortBy

type SortBy struct {
	Property  PropertyName
	Ascending bool
}

type SortQuery

type SortQuery struct {
	SortByList []SortBy
}

func NewSortQuery

func NewSortQuery(sortByListRaw []string) *SortQuery

NewSortQuery takes raw sort options list and returns SortQuery object. For example: ["a", "parameter1", "d", "parameter2"] - means that the data should be sorted by parameter1 (Ascending) and lster - for results that return equal under parameter1 sort - by parameter2 (Descending)

func NoSort

func NoSort() *SortQuery

type StdComparableEqualString

type StdComparableEqualString struct {
	StdComparableString
}

func (StdComparableEqualString) Contains

func (self StdComparableEqualString) Contains(otherV ComparableValue) bool

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 StdComparableRFC3339Timestamp

type StdComparableRFC3339Timestamp string

StdComparableRFC3339Timestamp takes RFC3339 Timestamp strings and compares them as TIMES. In case of time parsing error compares values as strings.

func (StdComparableRFC3339Timestamp) Compare

func (self StdComparableRFC3339Timestamp) Compare(otherV ComparableValue) int

func (StdComparableRFC3339Timestamp) Contains

func (self StdComparableRFC3339Timestamp) 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