formatters

package
v0.0.0-...-5b64428 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldColumnWidth uint = 31
View Source
var FileColumnWidth uint = 35
View Source
var TableClassifyFormatterOutputFormat = "%-36.36s %-32.32s %v\n"

Functions

func ErrUnexpectedType

func ErrUnexpectedType(val interface{}) error

Types

type CSVClassifyResultsFormatter

type CSVClassifyResultsFormatter struct {
}

func NewCSVClassifyResultsFormatter

func NewCSVClassifyResultsFormatter() *CSVClassifyResultsFormatter

func (*CSVClassifyResultsFormatter) Flush

func (f *CSVClassifyResultsFormatter) Flush(writer io.Writer) error

func (*CSVClassifyResultsFormatter) WriteResult

func (f *CSVClassifyResultsFormatter) WriteResult(writer io.Writer, filename string, result interface{}, options FormatOption) error

type CSVExtractionResultsFormatter

type CSVExtractionResultsFormatter struct {
}

func NewCSVExtractionResultsFormatter

func NewCSVExtractionResultsFormatter() *CSVExtractionResultsFormatter

func (*CSVExtractionResultsFormatter) Flush

func (f *CSVExtractionResultsFormatter) Flush(writer io.Writer) error

func (*CSVExtractionResultsFormatter) WriteResult

func (f *CSVExtractionResultsFormatter) WriteResult(writer io.Writer, filename string, result interface{}, options FormatOption) error

type FieldFormatter

type FieldFormatter struct {
	FieldResult results.FieldResult
	Separator   string
	NoResultStr string
}

FieldFormatter formats a results.FieldResult.

func NewFieldFormatter

func NewFieldFormatter(result results.FieldResult, separator, noResultStr string) *FieldFormatter

func (FieldFormatter) Results

func (f FieldFormatter) Results() []string

Results returns an array of results, taking field rejection and alternative results into account.

func (FieldFormatter) String

func (f FieldFormatter) String() string

Returns a comma-separated joined string of Results(), or NoResultText if Results() returns an empty array.

type FormatOption

type FormatOption int
const (
	IncludeHeader FormatOption = 1 << iota
	IncludeSeparator
)

type JsonClassifyResultsFormatter

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

func NewJsonClassifyResultsFormatter

func NewJsonClassifyResultsFormatter() *JsonClassifyResultsFormatter

func (*JsonClassifyResultsFormatter) Flush

func (f *JsonClassifyResultsFormatter) Flush(writer io.Writer) error

func (*JsonClassifyResultsFormatter) WriteResult

func (f *JsonClassifyResultsFormatter) WriteResult(writer io.Writer, filename string, result interface{}, options FormatOption) error

type JsonExtractionResultsFormatter

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

func NewJsonExtractionResultsFormatter

func NewJsonExtractionResultsFormatter() *JsonExtractionResultsFormatter

func (*JsonExtractionResultsFormatter) Flush

func (f *JsonExtractionResultsFormatter) Flush(writer io.Writer) error

func (*JsonExtractionResultsFormatter) WriteResult

func (f *JsonExtractionResultsFormatter) WriteResult(writer io.Writer, filename string, result interface{}, options FormatOption) error

type NoopResultsFormatter

type NoopResultsFormatter struct {
}

func NewNoopResultsFormatter

func NewNoopResultsFormatter() *NoopResultsFormatter

func (*NoopResultsFormatter) Flush

func (f *NoopResultsFormatter) Flush(writer io.Writer) error

func (*NoopResultsFormatter) WriteResult

func (f *NoopResultsFormatter) WriteResult(writer io.Writer, fullPath string, result interface{}, options FormatOption) error

type OutputFormat

type OutputFormat string
const (
	Table OutputFormat = "table"
	Json  OutputFormat = "json"
	Csv   OutputFormat = "csv"
)

type ResultsFormatter

type ResultsFormatter interface {
	WriteResult(writer io.Writer, filename string, result interface{}, options FormatOption) error
	Flush(writer io.Writer) error
}

type TableClassifyResultsFormatter

type TableClassifyResultsFormatter struct {
}

func NewTableClassifyResultsFormatter

func NewTableClassifyResultsFormatter() *TableClassifyResultsFormatter

func (*TableClassifyResultsFormatter) Flush

func (f *TableClassifyResultsFormatter) Flush(writer io.Writer) error

func (*TableClassifyResultsFormatter) WriteResult

func (f *TableClassifyResultsFormatter) WriteResult(writer io.Writer, fullPath string, result interface{}, options FormatOption) error

type TableExtractionResultsFormatter

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

func NewTableExtractionResultsFormatter

func NewTableExtractionResultsFormatter() *TableExtractionResultsFormatter

func (*TableExtractionResultsFormatter) Flush

func (*TableExtractionResultsFormatter) WriteResult

func (f *TableExtractionResultsFormatter) WriteResult(writer io.Writer, fullPath string, result interface{}, options FormatOption) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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