outformats

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVWriter

type CSVWriter struct {
	*csv.Writer
}

CSVWriter CSV format writer

func NewCSVWriter

func NewCSVWriter(w io.Writer) *CSVWriter

NewCSVWriter generate CSVWriter

func (*CSVWriter) Flush

func (w *CSVWriter) Flush()

type JSONWriter

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

JSONWriter JSON format writer

func NewJSONWriter

func NewJSONWriter(w io.Writer, fields []string) *JSONWriter

NewJSONWriter generate json writer fields are key field

func (*JSONWriter) Flush

func (w *JSONWriter) Flush()

func (*JSONWriter) Write

func (w *JSONWriter) Write(records []string) error

Write writes a single JSON record to w one line. A record is a slice of strings with each string being one field. Writes are buffered, so Flush must eventually be called to ensure that the record is written to the underlying io.Writer.

func (*JSONWriter) WriteAll

func (w *JSONWriter) WriteAll(records [][]string) error

WriteAll writes multiple json records to w using Write and then calls Flush, returning any error from the Flush.

type OutWriter

type OutWriter interface {
	WriteAll(records [][]string) error // 写入
	Flush()
}

OutWriter format writer interface

type XMLWriter

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

XMLWriter XML format writer

func NewXMLWriter

func NewXMLWriter(w io.Writer, fields []string) *XMLWriter

NewXMLWriter generate xml writer fields are key field

func (*XMLWriter) Flush

func (w *XMLWriter) Flush()

func (*XMLWriter) Write

func (w *XMLWriter) Write(records []string) error

Write writes a single JSON record to w one line. A record is a slice of strings with each string being one field. Writes are buffered, so Flush must eventually be called to ensure that the record is written to the underlying io.Writer.

func (*XMLWriter) WriteAll

func (w *XMLWriter) WriteAll(records [][]string) error

WriteAll writes multiple json records to w using Write and then calls Flush, returning any error from the Flush.

Jump to

Keyboard shortcuts

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