format

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format is an output format such as json or xml.

const (
	Text     Format = "text"
	JSON     Format = "json"
	JSONL    Format = "jsonl"
	JSONA    Format = "jsona"
	HTML     Format = "html"
	Markdown Format = "markdown"
	// MermaidERD emits a bare Mermaid.js erDiagram. It's implemented only for
	// sq inspect (source and table schema diagrams), so it's deliberately
	// absent from All: query commands have no record writer for it.
	MermaidERD Format = "mermaid-erd"
	// PNGERD renders sq inspect's schema entity-relationship diagram to a PNG
	// image. Like MermaidERD it's inspect-only (source and table schema) with
	// no record writer, so it's deliberately absent from All.
	PNGERD Format = "png-erd"
	// SVGERD renders sq inspect's schema entity-relationship diagram to an SVG
	// image. Inspect-only with no record writer; see PNGERD.
	SVGERD Format = "svg-erd"
	XLSX   Format = "xlsx"
	XML    Format = "xml"
	CSV    Format = "csv"
	TSV    Format = "tsv"
	Raw    Format = "raw"
	YAML   Format = "yaml"
)

Output format values.

func All

func All() []Format

All returns a new slice containing all format.Format values.

All deliberately omits MermaidERD: it's an inspect-only metadata format with no record writer, so advertising it for query commands (shell completion, format parity) would be misleading. See MermaidERD's doc comment.

func (Format) String

func (f Format) String() string

String returns the format value.

func (*Format) UnmarshalText

func (f *Format) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Opt added in v0.36.0

type Opt struct {
	options.BaseOpt
	// contains filtered or unexported fields
}

Opt is an options.Opt for format.Format.

func NewOpt added in v0.36.0

func NewOpt(key string, flag *options.Flag, defaultVal Format,
	validFn func(Format) error, usage, help string,
) Opt

NewOpt returns a new format.Opt instance. If validFn is non-nil, it is executed against possible values.

func (Opt) Default added in v0.47.0

func (op Opt) Default() Format

Default returns the default value of op.

func (Opt) DefaultAny added in v0.36.0

func (op Opt) DefaultAny() any

DefaultAny implements options.Opt.

func (Opt) Get added in v0.36.0

func (op Opt) Get(o options.Options) Format

Get returns op's value in o. If o is nil, or no value is set, op's default value is returned.

func (Opt) GetAny added in v0.36.0

func (op Opt) GetAny(o options.Options) any

GetAny implements options.Opt.

func (Opt) Process added in v0.36.0

func (op Opt) Process(o options.Options) (options.Options, error)

Process implements options.Processor. It converts matching string values in o into format.Format. If no match found, the input arg is returned unchanged. Otherwise, a clone is returned.

Jump to

Keyboard shortcuts

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