Documentation ¶
Index ¶
- Constants
- Variables
- func AddConfigContext(name, endpoint, apiKey string, dsID int) error
- func DeleteConfigContext(name string) error
- func GetVersion() string
- func NewLogger(levelStr string) (*slog.Logger, error)
- func SaveConfig(c *ConfigFile) error
- type CSVRenderer
- type ConfigContext
- type ConfigFile
- type JSONRenderer
- type Query
- type RedashClient
- func (rc *RedashClient) DeleteJob(ctx context.Context, id string) error
- func (rc *RedashClient) GetDataSources(ctx context.Context) ([]map[string]any, error)
- func (rc *RedashClient) GetJob(ctx context.Context, id string) (*RedashGetJobResponse, error)
- func (rc *RedashClient) GetQueryResult(ctx context.Context, id int) (*RedashGetQueryResultResponse, error)
- func (rc *RedashClient) PostQueryResults(ctx context.Context, req RedashPostQueryResultRequest) (*RedashGetJobResponse, error)
- func (rc *RedashClient) QueryAndWaitResult(ctx context.Context, req RedashPostQueryResultRequest) (*RedashGetQueryResultResponse, error)
- type RedashGetJobResponse
- type RedashGetQueryResultResponse
- type RedashPostQueryResultRequest
- type Renderer
- type TableRenderer
- type YAMLRenderer
Constants ¶
View Source
const ( RedashJobStatusPending = 1 RedashJobStatusStarted = 2 RedashJobStatusSuccess = 3 RedashJobStatusFailure = 4 RedashJobStatusCancelled = 5 )
View Source
const ( TableType1 tableType = iota TableType2 )
Variables ¶
View Source
var ( ErrQueryOpenParamNotFound = errors.New("`{{` not found") ErrorQueryCloseParamNotFound = errors.New("`}}` not found") )
Functions ¶
func AddConfigContext ¶
func DeleteConfigContext ¶
func GetVersion ¶
func GetVersion() string
func SaveConfig ¶
func SaveConfig(c *ConfigFile) error
Types ¶
type CSVRenderer ¶
type CSVRenderer struct {
// contains filtered or unexported fields
}
func (*CSVRenderer) SetShowHeader ¶
func (r *CSVRenderer) SetShowHeader(showHeader bool)
type ConfigContext ¶
type ConfigFile ¶
type ConfigFile struct {
Contexts map[string]*ConfigContext `json:"contexts"`
}
func LoadConfig ¶
func LoadConfig() (*ConfigFile, error)
type JSONRenderer ¶
type JSONRenderer struct {
// contains filtered or unexported fields
}
func (*JSONRenderer) SetShowHeader ¶
func (r *JSONRenderer) SetShowHeader(showHeader bool)
type RedashClient ¶
func NewRedashClient ¶
func NewRedashClient(endpoint, apiKey string, logger *slog.Logger) (*RedashClient, error)
func (*RedashClient) DeleteJob ¶
func (rc *RedashClient) DeleteJob(ctx context.Context, id string) error
func (*RedashClient) GetDataSources ¶
func (*RedashClient) GetJob ¶
func (rc *RedashClient) GetJob(ctx context.Context, id string) (*RedashGetJobResponse, error)
func (*RedashClient) GetQueryResult ¶
func (rc *RedashClient) GetQueryResult(ctx context.Context, id int) (*RedashGetQueryResultResponse, error)
func (*RedashClient) PostQueryResults ¶
func (rc *RedashClient) PostQueryResults(ctx context.Context, req RedashPostQueryResultRequest) (*RedashGetJobResponse, error)
func (*RedashClient) QueryAndWaitResult ¶
func (rc *RedashClient) QueryAndWaitResult(ctx context.Context, req RedashPostQueryResultRequest) (*RedashGetQueryResultResponse, error)
type RedashGetJobResponse ¶
type RedashGetQueryResultResponse ¶
type RedashGetQueryResultResponse struct { QueryResult struct { ID int `json:"id"` QueryHash string `json:"query_hash"` Query string `json:"query"` Data struct { Columns []struct { Name string `json:"name"` FriendlyName string `json:"friendly_name"` Type string `json:"type"` } `json:"columns"` Rows []map[string]any `json:"rows"` } `json:"data"` } `json:"query_result"` }
func (*RedashGetQueryResultResponse) GetTable ¶
func (r *RedashGetQueryResultResponse) GetTable() [][]string
type TableRenderer ¶
type TableRenderer struct { TableType tableType // contains filtered or unexported fields }
func (*TableRenderer) SetShowHeader ¶
func (r *TableRenderer) SetShowHeader(showHeader bool)
type YAMLRenderer ¶
type YAMLRenderer struct {
// contains filtered or unexported fields
}
func (*YAMLRenderer) SetShowHeader ¶
func (r *YAMLRenderer) SetShowHeader(showHeader bool)
Click to show internal directories.
Click to hide internal directories.