Documentation
¶
Overview ¶
Package output handles formatting and writing query results and errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintError ¶
func PrintError(qerr *agenterrors.QueryError)
PrintError writes a classified error to stderr as JSON.
func WriteError ¶
WriteError writes an error to stderr as JSON and sets the process exit code.
Types ¶
type Format ¶
type Format string
Format identifies an output format.
func ParseFormat ¶
ParseFormat parses a format string, returning an error for unknown formats.
type NDJSONWriter ¶
type NDJSONWriter struct {
// contains filtered or unexported fields
}
NDJSONWriter writes query results as NDJSON (one JSON object per line).
func NewNDJSONWriter ¶
func NewNDJSONWriter(w io.Writer) *NDJSONWriter
NewNDJSONWriter creates a new NDJSON result writer.
func (*NDJSONWriter) Flush ¶
func (n *NDJSONWriter) Flush() error
func (*NDJSONWriter) WritePagination ¶
func (n *NDJSONWriter) WritePagination(p *Pagination) error
type Pagination ¶
Pagination holds pagination metadata for result sets.
type ResultWriter ¶
type ResultWriter interface {
WriteRow(row map[string]any) error
WritePagination(p *Pagination) error
Flush() error
}
ResultWriter writes query results in a streaming fashion.
Click to show internal directories.
Click to hide internal directories.