Documentation
¶
Index ¶
- func LoadDir(dir string) (map[string]*Model, error)
- func LoadDirPartial(dir string) (map[string]*Model, map[string]error, error)
- func Names(models map[string]*Model) []string
- type Dimension
- type DimensionRef
- type Engine
- type Filter
- type Format
- type Metric
- type Model
- type Query
- type Segment
- type SortSpec
- type Source
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadDirPartial ¶
LoadDirPartial loads valid semantic models while keeping track of invalid named models so callers can fail only dashboards that reference them.
Types ¶
type Dimension ¶
type Dimension struct {
Name string `yaml:"name" json:"name"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"` // string, number, boolean, time
Expression string `yaml:"expression,omitempty" json:"expression,omitempty"`
Granularities map[string]string `yaml:"granularities,omitempty" json:"granularities,omitempty"`
Hidden bool `yaml:"hidden,omitempty" json:"hidden,omitempty"`
Group string `yaml:"group,omitempty" json:"group,omitempty"`
}
type DimensionRef ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine generates SQL from a Model and a Query.
type Metric ¶
type Metric struct {
Name string `yaml:"name" json:"name"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Expression string `yaml:"expression" json:"expression"`
Filter string `yaml:"filter,omitempty" json:"filter,omitempty"`
Hidden bool `yaml:"hidden,omitempty" json:"hidden,omitempty"`
Group string `yaml:"group,omitempty" json:"group,omitempty"`
Format *Format `yaml:"format,omitempty" json:"format,omitempty"`
Window *Window `yaml:"window,omitempty" json:"window,omitempty"`
}
type Model ¶
type Model struct {
Schema string `yaml:"schema,omitempty" json:"schema,omitempty"`
Name string `yaml:"name" json:"name"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Source Source `yaml:"source" json:"source"`
Dimensions []Dimension `yaml:"dimensions,omitempty" json:"dimensions,omitempty"`
Metrics []Metric `yaml:"metrics,omitempty" json:"metrics,omitempty"`
Segments []Segment `yaml:"segments,omitempty" json:"segments,omitempty"`
}
Model describes a single semantic model with dimensions, metrics, and segments.
type Query ¶
type Query struct {
Dimensions []DimensionRef `json:"dimensions,omitempty"`
Metrics []string `json:"metrics,omitempty"`
Filters []Filter `json:"filters,omitempty"`
Segments []string `json:"segments,omitempty"`
Sort []SortSpec `json:"sort,omitempty"`
Limit int `json:"limit,omitempty"`
}
Query specifies what to retrieve from a model.
type Window ¶
type Window struct {
Type string `yaml:"type,omitempty" json:"type,omitempty"` // running_total, lag, lead, rank, percent_of_total
OrderBy string `yaml:"order_by,omitempty" json:"order_by,omitempty"`
PartitionBy []string `yaml:"partition_by,omitempty" json:"partition_by,omitempty"`
Offset int `yaml:"offset,omitempty" json:"offset,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.