Documentation
¶
Overview ¶
Package sqlw provides output.SQLWriter implementations for the --render-sql mode of the slq command, where the rendered SQL is printed instead of being executed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONWriter ¶
type JSONWriter struct {
// contains filtered or unexported fields
}
JSONWriter is the SQLWriter implementation for the json and jsonl formats. compact toggles between pretty-printed and single-line output.
func NewJSONLWriter ¶
func NewJSONLWriter(out io.Writer, pr *output.Printing) *JSONWriter
NewJSONLWriter returns an output.SQLWriter that emits an SQLPayload as compact one-line JSON, suitable for jsonl pipelines. Color is honored when pr has color enabled.
func NewJSONWriter ¶
func NewJSONWriter(out io.Writer, pr *output.Printing) *JSONWriter
NewJSONWriter returns an output.SQLWriter that emits an SQLPayload as JSON, pretty-printed by default but compact when pr.Compact is true. For unconditionally single-line output (e.g. for jsonl pipelines), use NewJSONLWriter instead. Output honors the color palette in pr when color is enabled, matching the rest of sq's JSON output.
func (*JSONWriter) Render ¶
func (w *JSONWriter) Render(p output.SQLPayload) error
Render implements output.SQLWriter.
type TextWriter ¶
type TextWriter struct {
// contains filtered or unexported fields
}
TextWriter is the SQLWriter implementation for the text/raw formats.
func NewTextWriter ¶
func NewTextWriter(out io.Writer, pr *output.Printing) *TextWriter
NewTextWriter returns an output.SQLWriter that emits plain SQL followed by a newline. When pr has color enabled, the SQL is syntax-highlighted using sq's existing terminal palette so it blends with the rest of sq's output. When pr is monochrome the SQL is written as-is.
func (*TextWriter) Render ¶
func (w *TextWriter) Render(p output.SQLPayload) error
Render implements output.SQLWriter.
type YAMLWriter ¶
type YAMLWriter struct {
// contains filtered or unexported fields
}
YAMLWriter is the SQLWriter implementation for the yaml format.
func NewYAMLWriter ¶
func NewYAMLWriter(out io.Writer, pr *output.Printing) *YAMLWriter
NewYAMLWriter returns an output.SQLWriter that emits an SQLPayload as YAML. Output is colorized via yamlw to match sq's other YAML output.
func (*YAMLWriter) Render ¶
func (w *YAMLWriter) Render(p output.SQLPayload) error
Render implements output.SQLWriter.