format

package
v0.0.0-...-8550fa3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package format renders query results as CSV, TSV, or JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, f Format, result *redash.QueryResult) error

Write renders the result in the given format. Rows arrive as maps keyed by column name, so CSV/TSV column order is taken from result.Columns.

Types

type Format

type Format string

Format is an output format accepted by Write. It implements pflag.Value, so a --format typo is rejected while cobra parses the flags — before the command runs and submits the query to the server.

const (
	CSV  Format = "csv"
	TSV  Format = "tsv"
	JSON Format = "json"
)

Formats accepted by Write.

func (*Format) Set

func (f *Format) Set(s string) error

func (Format) String

func (f Format) String() string

func (Format) Type

func (Format) Type() string

Type names the value shown in the --format help line. It reports "string" rather than "format" because that help text is part of the agent-facing contract; see the documentation sync rule in CLAUDE.md.

Jump to

Keyboard shortcuts

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