output

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormattedPrinter

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

FormattedPrinter is a printer that knows how to parse the Kafkacat's format spec.

func NewFormatterPrinter

func NewFormatterPrinter(format string, out, errOut io.Writer) *FormattedPrinter

NewFormatterPrinter returns a new instance of a printer that supports formatting similar to kafkacat's. Format tokens:

	%s		Message payload
	%k		Message key
	%t		Topic
	%p		Partition
	%o		Offset
	%T		Timestamp in milliseconds
	%Tf		Timestamp formatted as RFC3339
 \n \r 	Newlines
	\t		Tab

func (*FormattedPrinter) Print

func (f *FormattedPrinter) Print(msg Msg)

Print applies a specific format to a consumed Kafka message.

func (*FormattedPrinter) PrintErr

func (f *FormattedPrinter) PrintErr(err error)

PrintErr knows how to print an error.

type Msg

type Msg struct {
	Key, Value        string
	Partition, Offset int
	Topic             string
	Time              time.Time
}

Msg is the successfully consumed Kafka message with some metadata for it.

type Printer

type Printer interface {
	Print(Msg)
	PrintErr(error)
}

Printer is the interface that knows how to print different results of a kafka consumer.

Jump to

Keyboard shortcuts

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