reporter

package
v0.0.0-...-cbe141c Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIReporter

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

APIReporter outputs api search results

func NewAPIReporter

func NewAPIReporter(ro *Options, writer io.Writer) *APIReporter

NewAPIReporter creates new API result reporter

func (*APIReporter) PrintAPINode

func (r *APIReporter) PrintAPINode(n shared.APINode) error

PrintAPINode prints single API result

func (*APIReporter) PrintAPISearchResult

func (r *APIReporter) PrintAPISearchResult(nl shared.APINodeList) error

PrintAPISearchResult prints a list of search results

type CSVReporter

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

CSVReporter outputs report for single food

func NewCSVReporter

func NewCSVReporter(options *Options, writer io.Writer) CSVReporter

NewCSVReporter creates new CSV reporter

func (CSVReporter) Flush

func (r CSVReporter) Flush() error

Flush does nothing

func (CSVReporter) Process

func (r CSVReporter) Process(ln *shared.LogNode) error

Process writes single node

type Options

type Options struct {
	CSV                  bool
	Color                bool
	TotalsOnly           bool
	Totals               bool
	DateFormat           string
	CaloriesLabel        string
	FatLabel             string
	CarbohydrateLabel    string
	ProteinLabel         string
	HasBeginning         bool
	HasEnd               bool
	BeginningTime        time.Time
	EndTime              time.Time
	Unresolved           bool
	SingleElement        string
	SingleFood           string
	CollapseLast         bool
	Collapse             bool
	ElementGroupByFood   bool
	ShortenStrings       bool
	UseOldRegReporter    bool
	InternalTemplateName string
}

Options contains the options for the reporter

func NewDefaultOptions

func NewDefaultOptions() *Options

NewDefaultOptions returns the default reporter options

type QuantityReporter

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

func NewQuantityReporter

func NewQuantityReporter(ascending bool, writer io.Writer) QuantityReporter

func (QuantityReporter) Flush

func (r QuantityReporter) Flush() error

Flush does nothing

func (QuantityReporter) Process

func (r QuantityReporter) Process(ln *shared.LogNode) error

Process writes single node

type Reporter

type Reporter interface {
	Process(ln *shared.LogNode) error
	Flush() error
}

Reporter is the reporting interface

func NewBalanceReporter

func NewBalanceReporter(options *Options, db shared.DBNodeList, writer io.Writer) Reporter

NewBalanceReporter returns balance reporter

func NewRegReporter

func NewRegReporter(options *Options, db shared.DBNodeList, writer io.Writer) Reporter

NewRegReporter creates new response handler

type SortTuple

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

type SummaryReporterTemplate

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

SummaryReporterTemplate is a summary reporter

func NewSummaryReporterTemplate

func NewSummaryReporterTemplate(options *Options, db shared.DBNodeList, writer io.Writer) *SummaryReporterTemplate

NewSummaryReporterTemplate creates new summary reporter

func (*SummaryReporterTemplate) Flush

func (r *SummaryReporterTemplate) Flush() error

Flush does nothing

func (*SummaryReporterTemplate) Process

func (r *SummaryReporterTemplate) Process(ln *shared.LogNode) error

Process process shared node

type UnsolvedReporter

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

UnsolvedReporter is unresolved reporter

func NewUnsolvedReporter

func NewUnsolvedReporter(options *Options, db shared.DBNodeList, writer io.Writer) *UnsolvedReporter

NewUnsolvedReporter returns reporter for unresolved elements

func (*UnsolvedReporter) Flush

func (r *UnsolvedReporter) Flush() error

Flush flushes the report

func (*UnsolvedReporter) Process

func (r *UnsolvedReporter) Process(ln *shared.LogNode) error

Process handles single node

Jump to

Keyboard shortcuts

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