feat: add back the InfluxQL REPL (#386)

* add v1-compatible query path and refactor other paths to de-duplicate "/query"

* add initial influxQL repl

* add ping endpoint to schema

* improve prompt UX, implement some commands

* fix json column type in schema and improve completion

* feat: add table formatter and move to forked go-prompt

* improve formatting and add table pagination

* implement more REPL commands, including insert and history

* implement "INSERT INTO"

* move repl command to "v1 repl"

* refactor and improve documentation

* clean up v1_repl cmd

* update to latest openapi, use some openapi paths instead of overrides

* remove additional files that were moved to openapi

* compute historyFilePath at REPL start

* clean up REPL use command logic flow

* clean up comments for TODOs now in issues

* move gopher (chonky boi)

* remove autocompletion for separate PR

* run go mod tidy

* add rfc3339 precision option

* allow left and right column scrolling to display whole table

* add error to JSON query response

* add tags and partial to JSON response series schema

* fix csv formatting and add column formatting

* remove table format for separate PR

* fix getDatabases

* move from write to legacy write endpoint for INSERT

* remove history vestiges

* allow multiple spaces in INSERT commands

* add precision comment

* remove auth for separate PR

* separate parseInsert and add unit test

* add additional test case and improve error messages

* fix missing errors import

* print rfc3339 precision

* add rfc3339 to help output
This commit is contained in:
Andrew Lee
2022-06-10 08:54:07 -06:00
committed by GitHub
parent 51ca97ee29
commit fc529745a5
44 changed files with 2959 additions and 305 deletions

View File

@ -18,31 +18,31 @@ import (
// Task struct for Task
type Task struct {
Id string `json:"id" yaml:"id"`
// Type of the task, useful for filtering a task list.
// The type of the task, useful for filtering a task list.
Type *string `json:"type,omitempty" yaml:"type,omitempty"`
// ID of the organization that owns the task.
// The ID of the organization that owns the task.
OrgID string `json:"orgID" yaml:"orgID"`
// Name of the organization that owns the task.
// The name of the organization that owns the task.
Org *string `json:"org,omitempty" yaml:"org,omitempty"`
// Name of the task.
// The name of the task.
Name string `json:"name" yaml:"name"`
// ID of the user who owns this Task.
// The ID of the user who owns this Task.
OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"`
// Description of the task.
// The description of the task.
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"`
Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"`
// ID of the authorization used when the task communicates with the query engine.
// The ID of the authorization used when the task communicates with the query engine.
AuthorizationID *string `json:"authorizationID,omitempty" yaml:"authorizationID,omitempty"`
// Flux script to run for this task.
// The Flux script to run for this task.
Flux string `json:"flux" yaml:"flux"`
// Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)).
// An interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. `every` also determines when the task first runs, depending on the specified time.
Every *string `json:"every,omitempty" yaml:"every,omitempty"`
// [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview).
// [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.
Cron *string `json:"cron,omitempty" yaml:"cron,omitempty"`
// [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals).
// A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.
Offset *string `json:"offset,omitempty" yaml:"offset,omitempty"`
// Timestamp of the latest scheduled and completed run. Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax).
// A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)) of the latest scheduled and completed run.
LatestCompleted *time.Time `json:"latestCompleted,omitempty" yaml:"latestCompleted,omitempty"`
LastRunStatus *string `json:"lastRunStatus,omitempty" yaml:"lastRunStatus,omitempty"`
LastRunError *string `json:"lastRunError,omitempty" yaml:"lastRunError,omitempty"`