Documentation
¶
Index ¶
- func LoadDir(dir string) (map[string]*Model, error)
- func LoadDirFS(fs afero.Fs, dir string) (map[string]*Model, error)
- func LoadDirPartial(dir string) (map[string]*Model, map[string]error, error)
- func LoadDirPartialFS(fs afero.Fs, 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 Join
- 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 LoadDirFS ¶
LoadDirFS loads every *.yml/*.yaml semantic model from a directory tree using the given filesystem.
func LoadDirPartial ¶
LoadDirPartial loads valid semantic models while keeping track of invalid named models so callers can fail only dashboards that reference them.
func LoadDirPartialFS ¶
LoadDirPartialFS loads valid semantic models using the given filesystem 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.
func NewEngineWithModels ¶
type Join ¶
type Join struct {
Name string `yaml:"name" json:"name"`
Model string `yaml:"model,omitempty" json:"model,omitempty"`
Relationship string `yaml:"relationship" json:"relationship"` // one_to_one, many_to_one, one_to_many, many_to_many
ForeignKey string `yaml:"foreign_key,omitempty" json:"foreign_key,omitempty"`
TargetKey string `yaml:"target_key,omitempty" json:"target_key,omitempty"`
SQL string `yaml:"sql,omitempty" json:"sql,omitempty"`
}
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"`
PrimaryKey string `yaml:"primary_key,omitempty" json:"primary_key,omitempty"`
Joins []Join `yaml:"joins,omitempty" json:"joins,omitempty"`
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.