middlewares

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 4 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JqObjectMiddleware added in v0.2.33

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

func NewJqObjectMiddleware added in v0.2.33

func NewJqObjectMiddleware(
	expression string,
) (*JqObjectMiddleware, error)

func (*JqObjectMiddleware) Close added in v0.3.1

func (jqm *JqObjectMiddleware) Close(ctx context.Context) error

func (*JqObjectMiddleware) Process added in v0.2.33

func (jqm *JqObjectMiddleware) Process(
	ctx context.Context,
	object types.Row,
) ([]types.Row, error)

type JqTableMiddleware added in v0.2.33

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

func NewJqTableMiddleware added in v0.2.33

func NewJqTableMiddleware(
	fieldExpressions map[types.FieldName]string,
) (*JqTableMiddleware, error)

func (*JqTableMiddleware) Close added in v0.3.1

func (jqm *JqTableMiddleware) Close(ctx context.Context) error

func (*JqTableMiddleware) Process added in v0.2.33

func (jqm *JqTableMiddleware) Process(ctx context.Context, table *types.Table) (*types.Table, error)

type ObjectMiddleware

type ObjectMiddleware interface {
	// Process transforms each individual object. Each object can return multiple
	// objects which will get processed individually downstream.
	Process(ctx context.Context, object types.Row) ([]types.Row, error)
	Close(ctx context.Context) error
}

type Processor added in v0.3.0

type Processor interface {
	AddRow(ctx context.Context, obj types.Row) error
	Close(ctx context.Context) error
}

type RowMiddleware added in v0.3.0

type RowMiddleware interface {
	Process(ctx context.Context, row types.Row) ([]types.Row, error)
	Close(ctx context.Context) error
}

type TableMiddleware

type TableMiddleware interface {
	// Process transforms a full table
	Process(ctx context.Context, table *types.Table) (*types.Table, error)
	Close(ctx context.Context) error
}

type TableProcessor added in v0.3.1

type TableProcessor struct {
	TableMiddlewares  []TableMiddleware
	ObjectMiddlewares []ObjectMiddleware
	RowMiddlewares    []RowMiddleware

	Table *types.Table
}

func NewTableProcessor added in v0.3.1

func NewTableProcessor(options ...TableProcessorOption) *TableProcessor

func (*TableProcessor) AddObjectMiddleware added in v0.3.1

func (p *TableProcessor) AddObjectMiddleware(mw ...ObjectMiddleware)

func (*TableProcessor) AddObjectMiddlewareAtIndex added in v0.3.1

func (p *TableProcessor) AddObjectMiddlewareAtIndex(i int, mw ...ObjectMiddleware)

func (*TableProcessor) AddObjectMiddlewareInFront added in v0.3.1

func (p *TableProcessor) AddObjectMiddlewareInFront(mw ...ObjectMiddleware)

func (*TableProcessor) AddRow added in v0.3.1

func (p *TableProcessor) AddRow(ctx context.Context, row types.Row) error

AddRow runs row through the chain of ObjectMiddlewares, then RowMiddlewares and adds the resulting rows to the table.

func (*TableProcessor) AddRowMiddleware added in v0.3.1

func (p *TableProcessor) AddRowMiddleware(mw ...RowMiddleware)

func (*TableProcessor) AddRowMiddlewareAtIndex added in v0.3.1

func (p *TableProcessor) AddRowMiddlewareAtIndex(i int, mw ...RowMiddleware)

func (*TableProcessor) AddRowMiddlewareInFront added in v0.3.1

func (p *TableProcessor) AddRowMiddlewareInFront(mw ...RowMiddleware)

func (*TableProcessor) AddTableMiddleware added in v0.3.1

func (p *TableProcessor) AddTableMiddleware(mw ...TableMiddleware)

func (*TableProcessor) AddTableMiddlewareAtIndex added in v0.3.1

func (p *TableProcessor) AddTableMiddlewareAtIndex(i int, mw ...TableMiddleware)

func (*TableProcessor) AddTableMiddlewareInFront added in v0.3.1

func (p *TableProcessor) AddTableMiddlewareInFront(mw ...TableMiddleware)

func (*TableProcessor) Close added in v0.3.1

func (p *TableProcessor) Close(ctx context.Context) error

func (*TableProcessor) GetTable added in v0.3.1

func (p *TableProcessor) GetTable() *types.Table

func (*TableProcessor) ReplaceTableMiddleware added in v0.3.1

func (p *TableProcessor) ReplaceTableMiddleware(mw ...TableMiddleware)

type TableProcessorOption added in v0.3.1

type TableProcessorOption func(*TableProcessor)

func WIthPrependTableMiddleware added in v0.3.0

func WIthPrependTableMiddleware(tm ...TableMiddleware) TableProcessorOption

func WithObjectMiddleware added in v0.3.0

func WithObjectMiddleware(om ...ObjectMiddleware) TableProcessorOption

func WithPrependObjectMiddleware added in v0.3.0

func WithPrependObjectMiddleware(om ...ObjectMiddleware) TableProcessorOption

func WithPrependRowMiddleware added in v0.3.0

func WithPrependRowMiddleware(rm ...RowMiddleware) TableProcessorOption

func WithRowMiddleware added in v0.3.0

func WithRowMiddleware(rm ...RowMiddleware) TableProcessorOption

func WithTableMiddleware added in v0.3.0

func WithTableMiddleware(tm ...TableMiddleware) TableProcessorOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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