Documentation ¶
Index ¶
- Constants
- func GetTableBySQLName(apiClient *metabase.APIClient, tableName string) (*metabase.Database, *metabase.DatabaseTable, error)
- func NewApiClient(cfg mo.Config) (*metabase.APIClient, *mo.AuthResponse, error)
- func NewApiClientEnv(cfg *mo.ConfigEnvOpts) (*metabase.APIClient, *mo.AuthResponse, error)
- func NewApiClientHttpClient(mbBaseUrl string, httpClient *http.Client) *metabase.APIClient
- func NewApiClientPasswordWithSessionId(serverURL, username, password, sessionId string, tlsSkipVerify bool) (*metabase.APIClient, *mo.AuthResponse, error)
- func NewApiClientSessionId(serverUrl, token string, tlsSkipVerify bool) *metabase.APIClient
- func QuerySQL(apiClient *metabase.APIClient, databaseID int64, sql string) (*metabase.DatasetQueryResults, *http.Response, error)
- func QuerySQLHttp(httpClient *http.Client, baseURL string, databaseID int64, sql string) (*http.Response, error)
- func SimpleQuery(databaseId, tableId int64) metabase.DatasetQueryJsonQuery
- func SqlResponseToTimeSeries(seriesName string, sr *SqlResponse, countColIdx, timeColIdx int) (timeseries.TimeSeries, error)
- type AppConfig
- type Record
- type Records
- type RecordsSet
- type SQLInfo
- type SqlData
- type SqlResponse
- func NewSqlResponse(bytes []byte) (*SqlResponse, error)
- func NewSqlResponseHttp(resp *http.Response) (*SqlResponse, error)
- func QuerySQLHttpMore(httpClient *http.Client, baseURL string, databaseID int64, sql string) (*SqlResponse, *http.Response, error)
- func QuerySQLInfo(httpClient *http.Client, baseURL string, opts SQLInfo) (*SqlResponse, error)
- func QuerySQLInfoTimeSeries(httpClient *http.Client, baseURL string, opts SQLInfo) (*timeseries.TimeSeries, *SqlResponse, error)
Constants ¶
View Source
const ( ApiUrlDataset = "/api/dataset" QueryTypeNative = "native" )
View Source
const MaxPerPage = int64(2000)
Variables ¶
This section is empty.
Functions ¶
func GetTableBySQLName ¶
func NewApiClient ¶
func NewApiClientEnv ¶
func NewApiClientEnv(cfg *mo.ConfigEnvOpts) (*metabase.APIClient, *mo.AuthResponse, error)
func NewApiClientHttpClient ¶
func NewApiClientSessionId ¶
func QuerySQLHttp ¶
func SimpleQuery ¶
func SimpleQuery(databaseId, tableId int64) metabase.DatasetQueryJsonQuery
func SqlResponseToTimeSeries ¶
func SqlResponseToTimeSeries(seriesName string, sr *SqlResponse, countColIdx, timeColIdx int) (timeseries.TimeSeries, error)
Types ¶
type AppConfig ¶
type AppConfig struct { Config string `short:"c" long:"config" description:"Config (cli,env)" required:"true"` URL string `short:"u" long:"url" description:"The base URL" required:"false"` Username string `short:"n" long:"username" description:"The username" required:"false"` Password string `short:"p" long:"password" description:"The password" required:"false"` SessionId string `short:"s" long:"sessionid" description:"The sessionId" required:"false"` TlsSkipVerify bool }
type Record ¶
type Record struct { Columns []metabase.DatasetQueryResultsMetadataColumn Cols []string Row []interface{} Related []Record }
func (*Record) GetStringOrEmpty ¶
type Records ¶
type Records struct { Columns []metabase.DatasetQueryResultsMetadataColumn Cols []string Rows [][]interface{} }
func GetAllRecords ¶
func GetAllRecordsSimple ¶
func NewRecordsFromJsonFile ¶
func (*Records) FilterRecordsString ¶
func (recs *Records) FilterRecordsString(key, val string) RecordsSet
func (*Records) FilterRecordsStringOr ¶
func (recs *Records) FilterRecordsStringOr(key string, vals []string) RecordsSet
func (*Records) InflateRecord ¶
func (*Records) RecordsSet ¶
func (recs *Records) RecordsSet() RecordsSet
type RecordsSet ¶
type RecordsSet struct {
Records []Record
}
func (*RecordsSet) Distinct ¶
func (recs *RecordsSet) Distinct(key string) RecordsSet
func (*RecordsSet) FilterRecordsString ¶
func (recs *RecordsSet) FilterRecordsString(key, val string) RecordsSet
type SQLInfo ¶
type SQLInfo struct { Name string DatabaseID int64 SQL string SQLFormat string SQLVars []interface{} ColIdxCount int ColIdxTime int }
SQLInfo holds the information for a SQL query.
type SqlResponse ¶
type SqlResponse struct {
Data SqlData `json:"data,omitempty"`
}
func NewSqlResponse ¶
func NewSqlResponse(bytes []byte) (*SqlResponse, error)
func NewSqlResponseHttp ¶
func NewSqlResponseHttp(resp *http.Response) (*SqlResponse, error)
func QuerySQLHttpMore ¶
func QuerySQLInfo ¶
QuerySQLInfo executes a raw SQL query
func QuerySQLInfoTimeSeries ¶
func QuerySQLInfoTimeSeries(httpClient *http.Client, baseURL string, opts SQLInfo) (*timeseries.TimeSeries, *SqlResponse, error)
QuerySQLInfoTimeSeries executes a raw SQL query that is designed to provide counts by date.
Click to show internal directories.
Click to hide internal directories.