Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v1.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 31 Imported by: 6

Documentation

Overview

Package cli contains the logic of the influx command line client.

Index

Constants

This section is empty.

Variables

View Source
var ErrBlankCommand = errors.New("empty input")

ErrBlankCommand is returned when a parsed command is empty.

Functions

This section is empty.

Types

type CommandLine

type CommandLine struct {
	Line       *liner.State
	URL        url.URL
	Host       string
	Port       int
	PathPrefix string
	Database   string
	Type       QueryLanguage
	Ssl        bool
	ClientCert string // path to the client certificate presented for mutual TLS
	ClientKey  string // path to the client private key for mutual TLS
	RootCA     string // path to the CA bundle used to verify the server certificate
	// InsecureCertificate ignores file permission checks when loading the client
	// certificate and key.
	InsecureCertificate bool
	// IgnoreCertSanityChecks loads the client certificate even when it fails the
	// sanity checks that decide whether it is usable for client authentication.
	IgnoreCertSanityChecks bool
	RetentionPolicy        string
	ClientVersion          string
	ServerVersion          string
	Pretty                 bool   // controls pretty print for json
	Format                 string // controls the output format.  Valid values are json, csv, or column
	Execute                string
	ShowVersion            bool
	Import                 bool
	Chunked                bool
	ChunkSize              int
	NodeID                 int
	Quit                   chan struct{}
	IgnoreSignals          bool // Ignore signals normally caught by this process (used primarily for testing)
	ForceTTY               bool // Force the CLI to act as if it were connected to a TTY

	Client         *client.Client
	ClientConfig   client.Config // Client config options.
	ImporterConfig v8.Config     // Importer configuration options.
	// contains filtered or unexported fields
}

CommandLine holds CLI configuration and state.

func New

func New(version string) *CommandLine

New returns an instance of CommandLine with the specified client version.

func (*CommandLine) Connect

func (c *CommandLine) Connect(cmd string) error

Connect connects to a server.

func (*CommandLine) ExecuteFluxQuery added in v1.7.0

func (c *CommandLine) ExecuteFluxQuery(w io.Writer, query string) error

func (*CommandLine) ExecuteQuery

func (c *CommandLine) ExecuteQuery(query string) error

ExecuteQuery runs any query statement.

func (*CommandLine) FormatResponse

func (c *CommandLine) FormatResponse(response *client.Response, w io.Writer)

FormatResponse formats output to the previously chosen format.

func (*CommandLine) Insert

func (c *CommandLine) Insert(stmt string) error

Insert runs an INSERT statement.

func (*CommandLine) ParseCommand

func (c *CommandLine) ParseCommand(cmd string) error

ParseCommand parses an instruction and calls the related method or executes the command as a query against InfluxDB.

func (*CommandLine) Run

func (c *CommandLine) Run() error

Run executes the CLI.

func (*CommandLine) SetAuth

func (c *CommandLine) SetAuth(cmd string)

SetAuth sets client authentication credentials.

func (*CommandLine) SetChunkSize added in v1.3.0

func (c *CommandLine) SetChunkSize(cmd string)

SetChunkSize sets the chunk size 0 sets it back to the default

func (*CommandLine) SetFormat

func (c *CommandLine) SetFormat(cmd string)

SetFormat sets output format.

func (*CommandLine) SetPrecision

func (c *CommandLine) SetPrecision(cmd string)

SetPrecision sets client precision.

func (*CommandLine) SetWriteConsistency

func (c *CommandLine) SetWriteConsistency(cmd string)

SetWriteConsistency sets write consistency level.

func (*CommandLine) Settings

func (c *CommandLine) Settings()

Settings prints current settings.

func (*CommandLine) Version

func (c *CommandLine) Version()

Version prints the CLI version.

type QueryLanguage added in v1.7.0

type QueryLanguage uint8
const (
	QueryLanguageInfluxQL QueryLanguage = iota
	QueryLanguageFlux
)

func (*QueryLanguage) Set added in v1.7.0

func (l *QueryLanguage) Set(s string) error

func (*QueryLanguage) String added in v1.7.0

func (l *QueryLanguage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL