output

package
v0.0.0-...-f545d20 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StdPrinter

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

StdPrinter implements `common.TxEntryProcessor` _interface_ and outputs the `common.TransactionEntry` instances onto the console for read consumption.

func NewStdPrinter

func NewStdPrinter(w io.Writer) *StdPrinter

NewStdPrinter creates a new printer with specified _w_ as `io.Writer`, if `nil` it will set `os.Stdout` as _w_.

func NewStdPrinterDefaults

func NewStdPrinterDefaults(w io.Writer, templates ...string) *StdPrinter

NewStdPrinterDefaults is the same as `NewStdPrinter` but it uses the built-in templates.

If supplying two templates, the first is considered to be header template and the second is a line template. Otherwise if one argument it is considered to be a full template.

A variation on two argument is when first argument is empty string and the second is a valid template, hence it will have no header but line template.

func (*StdPrinter) Flush

func (scp *StdPrinter) Flush() []common.TransactionEntry

func (*StdPrinter) FullTemplate

func (scp *StdPrinter) FullTemplate(fullTemplate string) *StdPrinter

FullTemplate will set the full template that is used when all `common.TransactionEntry` instances has been collected (when `Flush` is invoked).

Hence, the full template receives an array of `common.TransactionEntry` instead of one at the time (as with _lineTemplate_).

func (*StdPrinter) HeaderTemplate

func (scp *StdPrinter) HeaderTemplate(headerTemplate string) *StdPrinter

HeaderTemplate sets the header template that is emitted before the first entry is emitted using the line template.

If it is set and full template is used, it will be outputted before the full template when `Flush`. The template will receive the first available `common.TransactionEntry` to perform it's logic.

func (*StdPrinter) LineTemplate

func (scp *StdPrinter) LineTemplate(lineTemplate string) *StdPrinter

LineTemplate will set the line template that will be used for each `Process` invocation.

A line template will get one `common.TransactionEntry` at the time in it's context and hence may call any function on it.

func (*StdPrinter) Process

func (scp *StdPrinter) Process(tx common.TransactionEntry)

func (*StdPrinter) ProcessMany

func (scp *StdPrinter) ProcessMany(tx []common.TransactionEntry)

func (*StdPrinter) Reset

func (scp *StdPrinter) Reset()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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