outputs

package
v0.0.0-...-869cb35 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVOutput

type CSVOutput struct {
	// contains filtered or unexported fields
}

CSVOutput represents a TextQL output that transforms sql.Rows into CSV formatted string data using encoding/csv

func NewCSVOutput

func NewCSVOutput(opts *CSVOutputOptions) *CSVOutput

NewCSVOutput returns a new CSVOutput configured per the options provided.

func (*CSVOutput) Show

func (csvOutput *CSVOutput) Show(rows *sql.Rows)

Show writes the sql.Rows given to the destination in CSV format.

type CSVOutputOptions

type CSVOutputOptions struct {
	// WriteHeader determines if a header row based on the column names should be written.
	WriteHeader bool
	// Separator is the rune used to delimit fields.
	Separator rune
	// WriteTo is where the formatted data will be written to.
	WriteTo io.Writer
}

CSVOutputOptions define options that are passed to encoding/csv for formatting the output in specific ways.

type Output

type Output interface {
	// Show should display/write the sql.Rows to the implmentor's destination and format.
	Show(*sql.Rows)
}

Output implementors should accept sql.Rows and transform them however they need to in order to represent them in their specific format.

type PrettyCSVOutput

type PrettyCSVOutput struct {
	// contains filtered or unexported fields
}

PrettyCSVOutput represents a TextQL output that transforms sql.Rows into pretty tables

func NewPrettyCSVOutput

func NewPrettyCSVOutput(opts *PrettyCSVOutputOptions) *PrettyCSVOutput

NewPrettyCSVOutput returns a new PrettyCSVOutput configured per the options provided.

func (*PrettyCSVOutput) Show

func (prettyCsvOutput *PrettyCSVOutput) Show(rows *sql.Rows)

Show writes the sql.Rows given to the destination in tablewriter basic format.

type PrettyCSVOutputOptions

type PrettyCSVOutputOptions struct {
	// WriteHeader determines if a header row based on the column names should be written.
	WriteHeader bool
	// WriteTo is where the formatted data will be written to.
	WriteTo io.Writer
}

PrettyCSVOutputOptions define options that are passed to tablewriter for formatting the output in specific ways.

Jump to

Keyboard shortcuts

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