printer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVPrinter

type CSVPrinter struct {
	// Options of CSV format.
	Options CSVPrinterOptions
	// contains filtered or unexported fields
}

A Printer which output values as a CSV format.

func NewCSVPrinter

func NewCSVPrinter(o CSVPrinterOptions) *CSVPrinter

Create a new CSVPrinter

func (*CSVPrinter) Flush

func (p *CSVPrinter) Flush()

Flush data in the buffer. This function must be called to output all data.

func (*CSVPrinter) Write

func (p *CSVPrinter) Write(r []interface{})

Format and write fields represented as an array.

type CSVPrinterOptions

type CSVPrinterOptions struct {
	Out io.Writer

	// A string that represents end of line.
	CRLF string
	// Date format used to convert time.Time to string.
	DateFormat string
	// CSVPrinter quote the string value if QuoteString is true.
	QuoteString bool
	// Separator between columns.
	Separator string
}

A set of options used for CSV format.

func NewCSVPrinterOptions

func NewCSVPrinterOptions(output io.Writer) CSVPrinterOptions

Create a CSVPrinterOptions with default values set.

type Printer

type Printer interface {
	// Write buffered data to the underlying io.Writer.
	Flush()
	// Write an object represented as an array.
	Write(r []interface{})
}

Printer is the interface to output values.

type WidePrinter

type WidePrinter struct {
	Options WidePrinterOptions
	// contains filtered or unexported fields
}

func NewWidePrinter

func NewWidePrinter(o WidePrinterOptions) *WidePrinter

Create a new WidePrinter.

func (*WidePrinter) Flush

func (p *WidePrinter) Flush()

Flush data in the buffer. This function must be called to output all data.

func (*WidePrinter) Write

func (p *WidePrinter) Write(r []interface{})

Format and write fields represented as an array.

type WidePrinterOptions

type WidePrinterOptions struct {
	Out io.Writer

	CRLF       string
	DateFormat string
	Flags      uint
	MinWidth   int
	TabWidth   int
	Padding    int
	PadChar    byte
}

func NewWidePrinterOptions

func NewWidePrinterOptions(output io.Writer) WidePrinterOptions

Create a WidePrinterOptions with default values set.

Jump to

Keyboard shortcuts

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