view

package
v1.0.995 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

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 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"
)

type GaugeConfig added in v1.0.983

type GaugeConfig struct {
	Min        int              `json:"min,omitempty" yaml:"min,omitempty"`
	Max        int              `json:"max,omitempty" yaml:"max,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 {
	Value int    `json:"value" yaml:"value"`
	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, table string) ([]Row, error)

type ViewColumnDef added in v1.0.983

type ViewColumnDef 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
	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"`

	// 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"`
}

ViewColumnDef 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 (*ViewColumnDef) DeepCopy added in v1.0.983

func (in *ViewColumnDef) DeepCopy() *ViewColumnDef

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

func (*ViewColumnDef) DeepCopyInto added in v1.0.983

func (in *ViewColumnDef) DeepCopyInto(out *ViewColumnDef)

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

type ViewColumnDefList added in v1.0.983

type ViewColumnDefList []ViewColumnDef

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

Jump to

Keyboard shortcuts

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