Documentation ¶
Index ¶
- func ErrorsToJSON(errs []error) ([]byte, error)
- func ExecConfig(m2sCfg Config, funcSqlResp func(ds DatasetInfo, sr *SqlResponse) error) error
- func ExecDataset(m2sCfg Config, ds DatasetInfo, ...) error
- func QueryMetabaseTS(cfg Config, dsInfo DatasetInfo) (timeseries.TimeSeries, error)
- func SqlResponseToTS(seriesName string, sr *SqlResponse, countColIdx, dateColIdx int) (timeseries.TimeSeries, error)
- func SqlResponseToTable(sr *SqlResponse, kpiId int64, countColIdx, dateColIdx int) (table.Table, error)
- func UpdateSimpleKpi(cfg Config, dsInfo DatasetInfo) []error
- func UpdateSimpleKpiSqlResponse(cfg Config, dsInfo DatasetInfo, sqlResp *SqlResponse) []error
- func UpdateSimpleKpiTS(cfg Config, dsInfo DatasetInfo, ts timeseries.TimeSeries) []error
- func WriteSQLResponseCSV(ds DatasetInfo, sr *SqlResponse) error
- type Config
- func (cfg *Config) AddDatasets(datasets []DatasetInfo)
- func (cfg *Config) Exec() error
- func (cfg *Config) ExecFunc(funcSqlResp func(ds DatasetInfo, sr *SqlResponse) error) error
- func (cfg *Config) ExecWriteCSVs() error
- func (cfg *Config) InitClients() error
- func (cfg *Config) InitMetabaseClient() error
- func (cfg *Config) InitSimplekpiClient() error
- type Constraints
- type DatasetInfo
- type JSONQuery
- type SqlData
- type SqlResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorsToJSON ¶
func ExecConfig ¶
func ExecConfig(m2sCfg Config, funcSqlResp func(ds DatasetInfo, sr *SqlResponse) error) error
func ExecDataset ¶
func ExecDataset(m2sCfg Config, ds DatasetInfo, funcSqlResp func(ds DatasetInfo, sr *SqlResponse) error) error
func QueryMetabaseTS ¶ added in v0.1.1
func QueryMetabaseTS(cfg Config, dsInfo DatasetInfo) (timeseries.TimeSeries, error)
func SqlResponseToTS ¶ added in v0.1.1
func SqlResponseToTS(seriesName string, sr *SqlResponse, countColIdx, dateColIdx int) (timeseries.TimeSeries, error)
func SqlResponseToTable ¶
func UpdateSimpleKpi ¶
func UpdateSimpleKpi(cfg Config, dsInfo DatasetInfo) []error
func UpdateSimpleKpiSqlResponse ¶
func UpdateSimpleKpiSqlResponse(cfg Config, dsInfo DatasetInfo, sqlResp *SqlResponse) []error
func UpdateSimpleKpiTS ¶ added in v0.1.1
func UpdateSimpleKpiTS(cfg Config, dsInfo DatasetInfo, ts timeseries.TimeSeries) []error
func WriteSQLResponseCSV ¶
func WriteSQLResponseCSV(ds DatasetInfo, sr *SqlResponse) error
Types ¶
type Config ¶
type Config struct { MetabaseConfig mo.Config SimplekpiConfig simplekpiutil.Config SimplekpiUserID int64 LoadSimpleKpi bool Datasets []DatasetInfo MetabaseHttpClient *http.Client SimplekpiApiClient *simplekpi.APIClient }
Config runs a set of Metabase to SimpleKPI queries. Call Config.InitClients() and then Config.Exec() or Config.ExecWriteCSVs().
func (*Config) AddDatasets ¶
func (cfg *Config) AddDatasets(datasets []DatasetInfo)
func (*Config) ExecFunc ¶
func (cfg *Config) ExecFunc(funcSqlResp func(ds DatasetInfo, sr *SqlResponse) error) error
func (*Config) ExecWriteCSVs ¶
func (*Config) InitClients ¶
func (*Config) InitMetabaseClient ¶
func (*Config) InitSimplekpiClient ¶
type Constraints ¶
type DatasetInfo ¶
type DatasetInfo struct { KpiName string `json:"kpiName"` MetricName string `json:"metricName"` MetabaseQueryExec bool `json:"metabaseExec"` MetabaseQuery metabaseutil.SQLInfo `json:"metabaseQuery"` SimplekpiUpdateExec bool `json:"simplekpiExec"` SimplekpiKpiId int `json:"simplekpiKpiId"` }
DatasetInfo captures information for a single SQL query representing data for a single KPI.
func (*DatasetInfo) Inflate ¶
func (dsi *DatasetInfo) Inflate()
type JSONQuery ¶
type JSONQuery struct { Database int `json:"database"` Type string `json:"type"` Constraints Constraints `json:"constraints"` }
type SqlResponse ¶
type SqlResponse struct { Context string `json:"context,omitempty"` Data SqlData `json:"data,omitempty"` Error string `json:"error,omitempty"` JSONQuery JSONQuery `json:"json_query"` RowCount int `json:"row_count"` RunningTime int `json:"running_time"` StartedAt time.Time `json:"started_at"` Status string `json:"status,omitempty"` }
SqlResponse represents a Metabase API SQL response body.
func HTTPResponseToSqlResponse ¶
func HTTPResponseToSqlResponse(resp *http.Response) (*SqlResponse, error)
HTTPResponseToSqlResponse parses a Metabase SQL response.
func QueryMetabase ¶
func QueryMetabase(cfg Config, dsInfo DatasetInfo) (*SqlResponse, error)
Click to show internal directories.
Click to hide internal directories.