output

package
v0.0.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func IsValid

func IsValid(f Format) bool

Types

type Envelope

type Envelope struct {
	OK            bool         `json:"ok" yaml:"ok"`
	SchemaVersion int          `json:"schema_version" yaml:"schema_version"`
	Error         *ErrorObject `json:"error,omitempty" yaml:"error,omitempty"`
	Data          any          `json:"data,omitempty" yaml:"data,omitempty"`
}

type ErrorObject

type ErrorObject struct {
	Code    errors.Code    `json:"code" yaml:"code"`
	Message string         `json:"message" yaml:"message"`
	Details map[string]any `json:"details,omitempty" yaml:"details,omitempty"`
}

type Format

type Format string
const (
	FormatAuto  Format = "auto"
	FormatJSON  Format = "json"
	FormatYAML  Format = "yaml"
	FormatTable Format = "table"
	FormatCSV   Format = "csv"
)

type Writer

type Writer struct {
	Out io.Writer
	Err io.Writer
}

func New

func New(out, err io.Writer) Writer

func (Writer) WriteError

func (w Writer) WriteError(format Format, xe *errors.XError) error

func (Writer) WriteOK

func (w Writer) WriteOK(format Format, data any) error

Jump to

Keyboard shortcuts

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