dataquery

package
v1.0.983 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferColumnTypes added in v1.0.982

func InferColumnTypes(rows []QueryResultRow) map[string]string

InferColumnTypes analyzes the first row to determine column types

Types

type JoinCondition added in v1.0.982

type JoinCondition struct {
	LeftTable   string `json:"left_table" yaml:"left_table"`
	LeftColumn  string `json:"left_column" yaml:"left_column"`
	RightTable  string `json:"right_table" yaml:"right_table"`
	RightColumn string `json:"right_column" yaml:"right_column"`
}

JoinCondition represents a join condition between two tables

type MergeOperation added in v1.0.982

type MergeOperation string

MergeOperation represents the type of merge operation

const (
	MergeLeftJoin MergeOperation = "LEFT_JOIN"
	MergeUnion    MergeOperation = "UNION"
)

type MergeSpec added in v1.0.982

type MergeSpec struct {
	Operation MergeOperation `json:"operation" yaml:"operation"`

	// For JOIN operations
	JoinConditions []JoinCondition `json:"join_conditions,omitempty" yaml:"join_conditions,omitempty"`
}

MergeSpec defines how to merge query result sets

type PrometheusQuery

type PrometheusQuery struct {
	connection.PrometheusConnection `json:",inline" yaml:",inline"`

	// Query is the PromQL query string
	Query string `json:"query" yaml:"query"`
}

+kubebuilder:object:generate=true PrometheusQuery defines a Prometheus query configuration

func (*PrometheusQuery) DeepCopy

func (in *PrometheusQuery) DeepCopy() *PrometheusQuery

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

func (*PrometheusQuery) DeepCopyInto

func (in *PrometheusQuery) DeepCopyInto(out *PrometheusQuery)

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

type Query

type Query struct {
	// Prometheus queries metrics from Prometheus
	Prometheus *PrometheusQuery `json:"prometheus,omitempty" yaml:"prometheus,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 QueryResultRow

type QueryResultRow map[string]any

func ExecuteQuery

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

ExecuteQuery executes a single query and returns results with query name

func MergeQueryResults added in v1.0.982

func MergeQueryResults(ctx context.Context, resultsets []QueryResultSet, merge MergeSpec) ([]QueryResultRow, error)

MergeQueryResults merges multiple query result sets into a single result set using the specified merge strategy

type QueryResultSet added in v1.0.982

type QueryResultSet struct {
	Name       string
	PrimaryKey []string
	Results    []QueryResultRow
}

QueryResultSet contains the query name and the results

func (QueryResultSet) CreateDBTable added in v1.0.982

func (resultSet QueryResultSet) CreateDBTable(ctx context.Context) error

CreateDBTable creates a SQLite table based on the result set schema

func (QueryResultSet) InsertToDB added in v1.0.982

func (rs QueryResultSet) InsertToDB(ctx context.Context) error

InsertToDB inserts QueryResultRow data into the specified table

Jump to

Keyboard shortcuts

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