processor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlazeProcessor

type GlazeProcessor struct {
	*middlewares.Processor
	// contains filtered or unexported fields
}

GlazeProcessor is a simple wrapper around a middlewares.Processor that also handles an OutputFormatter.

NOTE(manuel, 2023-06-28) At the end of tackling the big refactor of both ordered map rows and a new row middleware concept, and introducing the dedicated middlewares.Processor, this interface seems a bit unnecessary / confusing.

https://github.com/go-go-golems/glazed/issues/310

Because I am planning to add streaming output so that we can cut down on memory usage in sqleton, I might revisit this and find a better way to: - connect a middleares processor to an output formatter

  • for example, an output formatter could actually be a final middleware step
  • streaming output formatters could be registered as a row middleware (and we could have multiple streaming row level output formatters for debugging and monitoring purposes)
  • normal output formatters could be registered as a table middleware that gets called once the entire input has been processed.

Approaching everything as middlewares would allow us to work long running glazed commands, and if no TableMiddleware is registered, we can discard values altogether after they've been run through the row middlewares.

func NewSimpleGlazeProcessor

func NewSimpleGlazeProcessor(options ...GlazeProcessorOption) (*GlazeProcessor, error)

func (*GlazeProcessor) OutputFormatter

func (gp *GlazeProcessor) OutputFormatter() formatters.TableOutputFormatter

type GlazeProcessorOption added in v0.2.83

type GlazeProcessorOption func(*GlazeProcessor)

type TableProcessor added in v0.3.0

type TableProcessor interface {
	// TODO(manuel, 2023-06-28) There is some cleanup to be done on those Processor APIs
	AddRowMiddleware(mw ...middlewares.RowMiddleware)

	AddRow(ctx context.Context, obj types.Row) error
	OutputFormatter() formatters.TableOutputFormatter
	Finalize(ctx context.Context) error
	GetTable() *types.Table
}

Jump to

Keyboard shortcuts

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