view

package
v1.0.1014 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const ReservedColumnAttributes = "__row__attributes"

Variables

This section is empty.

Functions

func CreateViewTable added in v1.0.983

func CreateViewTable(ctx context.Context, table string, columns ViewColumnDefList) error

func ExecuteQuery

func ExecuteQuery(ctx context.Context, q Query) ([]dataquery.QueryResultRow, error)

ExecuteQuery executes a single query and returns results with query name

func GetAllViews added in v1.0.983

func GetAllViews(ctx context.Context) ([]models.View, error)

func InsertViewRows added in v1.0.983

func InsertViewRows(ctx context.Context, table string, columns ViewColumnDefList, rows []Row) error

Types

type ColumnDef added in v1.0.1008

type ColumnDef struct {
	// Name of the column
	Name string `json:"name" yaml:"name"`

	// PrimaryKey indicates if the column is a primary key
	PrimaryKey bool `json:"primaryKey,omitempty" yaml:"primaryKey,omitempty"`

	// +kubebuilder:validation:Enum=string;number;boolean;datetime;duration;health;status;gauge;bytes;decimal;millicore;url;badge
	Type ColumnType `json:"type" yaml:"type"`

	// Description of the column
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// Hidden indicates if the column should be hidden from view
	Hidden bool `json:"hidden,omitempty" yaml:"hidden,omitempty"`

	// Configuration for gauge visualization
	Gauge *GaugeConfig `json:"gauge,omitempty" yaml:"gauge,omitempty"`

	// Deprecated: Use properties instead. Example: URL
	//
	// For references the column this column is for.
	// Applicable only for type=url.
	//
	// When a column is designated for a different column,
	// it's not rendered on the UI but the designated column uses it to render itself.
	For *string `json:"for,omitempty" yaml:"for,omitempty"`

	// Enable filters in the UI
	Filter *ColumnFilter `json:"filter,omitempty" yaml:"filter,omitempty"`

	// Link to various mission control components.
	URL *ColumnURL `json:"url,omitempty" yaml:"url,omitempty"`

	// Unit of the column
	Unit string `json:"unit,omitempty" yaml:"unit,omitempty"`
}

ColumnDef defines a column in the view +kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="self.type=='gauge' ? has(self.gauge) : !has(self.gauge)",message="gauge config required when type is gauge, not allowed for other types"

func (*ColumnDef) DeepCopy added in v1.0.1008

func (in *ColumnDef) DeepCopy() *ColumnDef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDef.

func (*ColumnDef) DeepCopyInto added in v1.0.1008

func (in *ColumnDef) DeepCopyInto(out *ColumnDef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ColumnDef) HasAttributes added in v1.0.1011

func (c *ColumnDef) HasAttributes() bool

type ColumnFilter added in v1.0.1005

type ColumnFilter struct {
	Type ColumnFilterType `json:"type" yaml:"type"`
}

type ColumnFilterType added in v1.0.1005

type ColumnFilterType string
const (
	ColumnFilterTypeMultiSelect ColumnFilterType = "multiselect"
)

type ColumnType added in v1.0.983

type ColumnType string
const (
	ColumnTypeBoolean   ColumnType = "boolean"
	ColumnTypeBytes     ColumnType = "bytes"
	ColumnTypeDateTime  ColumnType = "datetime"
	ColumnTypeDecimal   ColumnType = "decimal"
	ColumnTypeDuration  ColumnType = "duration"
	ColumnTypeGauge     ColumnType = "gauge"
	ColumnTypeHealth    ColumnType = "health"
	ColumnTypeMillicore ColumnType = "millicore"
	ColumnTypeNumber    ColumnType = "number"
	ColumnTypeStatus    ColumnType = "status"
	ColumnTypeString    ColumnType = "string"
	ColumnTypeURL       ColumnType = "url"
	ColumnTypeBadge     ColumnType = "badge"

	// reserved type for internal use.
	// Stores properties for all the columns in a row.
	ColumnTypeAttributes ColumnType = "row_attributes"
)

type ColumnURL added in v1.0.1008

type ColumnURL struct {
	// ID of the config to link to.
	Config string `json:"config,omitempty" template:"true"`

	// Link to a view.
	View *ViewURLRef `json:"view,omitempty" template:"true"`
}

+kubebuilder:object:generate=true

func (*ColumnURL) DeepCopy added in v1.0.1008

func (in *ColumnURL) DeepCopy() *ColumnURL

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnURL.

func (*ColumnURL) DeepCopyInto added in v1.0.1008

func (in *ColumnURL) DeepCopyInto(out *ColumnURL)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ColumnURL) Eval added in v1.0.1008

func (colURL ColumnURL) Eval(env map[string]any) (any, error)

type GaugeConfig added in v1.0.983

type GaugeConfig struct {
	Max        string           `json:"max,omitempty" yaml:"max,omitempty"`
	Min        string           `json:"min,omitempty" yaml:"min,omitempty"`
	Precision  int              `json:"precision,omitempty" yaml:"precision,omitempty"`
	Thresholds []GaugeThreshold `json:"thresholds,omitempty" yaml:"thresholds,omitempty"`
}

GaugeConfig defines configuration for gauge visualization +kubebuilder:object:generate=true

func (*GaugeConfig) DeepCopy added in v1.0.983

func (in *GaugeConfig) DeepCopy() *GaugeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaugeConfig.

func (*GaugeConfig) DeepCopyInto added in v1.0.983

func (in *GaugeConfig) DeepCopyInto(out *GaugeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GaugeThreshold added in v1.0.983

type GaugeThreshold struct {
	// Deprecated: Use Percent instead
	// +kubebuilder:validation:Optional
	Value int `json:"value,omitempty" yaml:"value,omitempty"`

	// Percent is the percentage value of the threshold
	Percent int `json:"percent" yaml:"percent"`

	// Color is the color of the threshold
	Color string `json:"color" yaml:"color"`
}

GaugeThreshold defines a threshold configuration for gauge charts +kubebuilder:object:generate=true

func (*GaugeThreshold) DeepCopy added in v1.0.983

func (in *GaugeThreshold) DeepCopy() *GaugeThreshold

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaugeThreshold.

func (*GaugeThreshold) DeepCopyInto added in v1.0.983

func (in *GaugeThreshold) DeepCopyInto(out *GaugeThreshold)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Query

type Query struct {
	dataquery.Query `json:",inline" yaml:",inline"`

	// Configs queries config items
	Configs *types.ResourceSelector `json:"configs,omitempty" yaml:"configs,omitempty"`

	// Changes queries config changes
	Changes *types.ResourceSelector `json:"changes,omitempty" yaml:"changes,omitempty"`
}

+kubebuilder:object:generate=true

func (*Query) DeepCopy

func (in *Query) DeepCopy() *Query

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Query.

func (*Query) DeepCopyInto

func (in *Query) DeepCopyInto(out *Query)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Query) IsEmpty

func (v *Query) IsEmpty() bool

type Row added in v1.0.983

type Row []any

Row represents a single row of data mapped to view columns

func ReadViewTable added in v1.0.983

func ReadViewTable(ctx context.Context, columnDef ViewColumnDefList, table string) ([]Row, error)

type ViewColumnDefList added in v1.0.983

type ViewColumnDefList []ColumnDef

func GetViewColumnDefs added in v1.0.983

func GetViewColumnDefs(ctx context.Context, namespace, name string) (ViewColumnDefList, error)

func (ViewColumnDefList) PrimaryKey added in v1.0.983

func (c ViewColumnDefList) PrimaryKey() []string

func (ViewColumnDefList) QuotedColumns added in v1.0.997

func (c ViewColumnDefList) QuotedColumns() []string

func (ViewColumnDefList) SelectColumns added in v1.0.983

func (c ViewColumnDefList) SelectColumns() []string

func (ViewColumnDefList) ToColumnTypeMap added in v1.0.983

func (c ViewColumnDefList) ToColumnTypeMap() map[string]models.ColumnType

type ViewURLRef added in v1.0.1008

type ViewURLRef struct {
	Namespace string            `json:"namespace,omitempty" template:"true"`
	Name      string            `json:"name,omitempty" template:"true"`
	Filter    map[string]string `json:"filter,omitempty" template:"true"`
}

+kubebuilder:object:generate=true

func (*ViewURLRef) DeepCopy added in v1.0.1008

func (in *ViewURLRef) DeepCopy() *ViewURLRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ViewURLRef.

func (*ViewURLRef) DeepCopyInto added in v1.0.1008

func (in *ViewURLRef) DeepCopyInto(out *ViewURLRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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