queryir

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyNative

func ApplyNative(sql string, params []Parameter, values map[string]any) (string, []any, error)

func CheckIdent

func CheckIdent(label, value string) error

func FilterValues

func FilterValues(value any) []any

func Quote

func Quote(identName string) string

func QuotePath

func QuotePath(name string) string

Types

type Aggregation

type Aggregation struct {
	Fn    string `json:"fn"`
	Field string `json:"field,omitempty"`
	Alias string `json:"alias,omitempty"`
}

type Breakout

type Breakout struct {
	Field    string  `json:"field"`
	Temporal string  `json:"temporal,omitempty"`
	BinWidth float64 `json:"bin_width,omitempty"`
}

type Compiled

type Compiled struct {
	SQL  string
	Args []any
}

type DrillRequest

type DrillRequest struct {
	Kind     string         `json:"kind"`
	Field    string         `json:"field,omitempty"`
	Value    any            `json:"value,omitempty"`
	Values   map[string]any `json:"values,omitempty"`
	Temporal string         `json:"temporal,omitempty"`
	Join     *Join          `json:"join,omitempty"`
}

type Expression

type Expression struct {
	Alias string `json:"alias"`
	Op    string `json:"op"`
	Left  string `json:"left"`
	Right any    `json:"right,omitempty"`
}

type Filter

type Filter struct {
	Field     string   `json:"field,omitempty"`
	Op        string   `json:"op,omitempty"`
	Value     any      `json:"value,omitempty"`
	SegmentID string   `json:"segment_id,omitempty"`
	And       []Filter `json:"and,omitempty"`
	Or        []Filter `json:"or,omitempty"`
}

type Join

type Join struct {
	Type       string          `json:"type"`
	Alias      string          `json:"alias,omitempty"`
	Table      *TableRef       `json:"table,omitempty"`
	Conditions []JoinCondition `json:"conditions,omitempty"`
	Implicit   bool            `json:"implicit,omitempty"`
}

type JoinCondition

type JoinCondition struct {
	Left  string `json:"left"`
	Right string `json:"right"`
	Op    string `json:"op,omitempty"`
}

type MappedValue

type MappedValue struct {
	Field string
	Type  string
	Value any
}

type Order

type Order struct {
	Field string `json:"field"`
	Dir   string `json:"dir,omitempty"`
}

type Parameter

type Parameter struct {
	Name  string `json:"name"`
	Type  string `json:"type,omitempty"`
	Field string `json:"field,omitempty"`
}

type Query

type Query struct {
	Version      int           `json:"version"`
	Source       Source        `json:"source"`
	Joins        []Join        `json:"joins,omitempty"`
	Expressions  []Expression  `json:"expressions,omitempty"`
	Fields       []string      `json:"fields,omitempty"`
	Filters      []Filter      `json:"filters,omitempty"`
	Aggregations []Aggregation `json:"aggregations,omitempty"`
	GroupBy      []Breakout    `json:"group_by,omitempty"`
	Having       []Filter      `json:"having,omitempty"`
	OrderBy      []Order       `json:"order_by,omitempty"`
	Limit        int           `json:"limit,omitempty"`
	Parameters   []Parameter   `json:"parameters,omitempty"`
}

func ApplyMappedFilters

func ApplyMappedFilters(q Query, mappings []MappedValue, now time.Time) (Query, error)

ApplyMappedFilters adds dashboard filter values onto a card query.

func Clone

func Clone(q Query) Query

func Drill

func Drill(q Query, req DrillRequest) (Query, error)

func (Query) Validate

func (q Query) Validate() error

type Source

type Source struct {
	DatabaseID string    `json:"database_id"`
	Table      *TableRef `json:"table,omitempty"`
	ModelID    string    `json:"model_id,omitempty"`
	QuestionID string    `json:"question_id,omitempty"`
	MetricID   string    `json:"metric_id,omitempty"`
	Alias      string    `json:"alias,omitempty"`
}

type TableRef

type TableRef struct {
	Schema string `json:"schema"`
	Name   string `json:"name"`
}

Jump to

Keyboard shortcuts

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