restructure

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 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 Op

type Op struct {
	OpApplier
}

Op is a designated operation on an entry

func (Op) MarshalJSON

func (o Op) MarshalJSON() ([]byte, error)

MarshalJSON will marshal an operation as JSON

func (Op) MarshalYAML

func (o Op) MarshalYAML() (interface{}, error)

MarshalYAML will marshal an operation as YAML

func (*Op) UnmarshalJSON

func (o *Op) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into an operation

func (*Op) UnmarshalYAML

func (o *Op) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into an operation

type OpAdd

type OpAdd struct {
	Field entry.Field `json:"field" yaml:"field"`
	Value interface{} `json:"value,omitempty" yaml:"value,omitempty"`

	ValueExpr *string `json:"value_expr,omitempty" yaml:"value_expr,omitempty"`
	// contains filtered or unexported fields
}

OpAdd is an operation for adding fields to an entry

func (*OpAdd) Apply

func (op *OpAdd) Apply(e *entry.Entry) error

Apply will perform the add operation on an entry

func (*OpAdd) Type

func (op *OpAdd) Type() string

Type will return the type of operation

func (*OpAdd) UnmarshalJSON

func (op *OpAdd) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into the add operation

func (*OpAdd) UnmarshalYAML

func (op *OpAdd) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into the add operation

type OpApplier

type OpApplier interface {
	Apply(entry *entry.Entry) error
	Type() string
}

OpApplier is an entity that applies an operation

type OpFlatten

type OpFlatten struct {
	Field entry.RecordField
}

OpFlatten is an operation for flattening fields

func (*OpFlatten) Apply

func (op *OpFlatten) Apply(e *entry.Entry) error

Apply will perform the flatten operation on an entry

func (OpFlatten) MarshalJSON

func (op OpFlatten) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a flatten operation into JSON

func (OpFlatten) MarshalYAML

func (op OpFlatten) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a flatten operation into YAML

func (*OpFlatten) Type

func (op *OpFlatten) Type() string

Type will return the type of operation

func (*OpFlatten) UnmarshalJSON

func (op *OpFlatten) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a flatten operation

func (*OpFlatten) UnmarshalYAML

func (op *OpFlatten) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a flatten operation

type OpMove

type OpMove struct {
	From entry.Field `json:"from" yaml:"from,flow"`
	To   entry.Field `json:"to" yaml:"to,flow"`
}

OpMove is an operation for moving entry fields

func (*OpMove) Apply

func (op *OpMove) Apply(e *entry.Entry) error

Apply will perform the move operation on an entry

func (*OpMove) Type

func (op *OpMove) Type() string

Type will return the type of operation

type OpRemove

type OpRemove struct {
	Field entry.Field
}

OpRemove is operation for removing fields from an entry

func (*OpRemove) Apply

func (op *OpRemove) Apply(e *entry.Entry) error

Apply will perform the remove operation on an entry

func (OpRemove) MarshalJSON

func (op OpRemove) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a remove operation into JSON

func (OpRemove) MarshalYAML

func (op OpRemove) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a remove operation into YAML

func (*OpRemove) Type

func (op *OpRemove) Type() string

Type will return the type of operation

func (*OpRemove) UnmarshalJSON

func (op *OpRemove) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a remove operation

func (*OpRemove) UnmarshalYAML

func (op *OpRemove) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a remove operation

type OpRetain

type OpRetain struct {
	Fields []entry.Field
}

OpRetain is an operation for retaining fields

func (*OpRetain) Apply

func (op *OpRetain) Apply(e *entry.Entry) error

Apply will perform the retain operation on an entry

func (OpRetain) MarshalJSON

func (op OpRetain) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a retain operation into JSON

func (OpRetain) MarshalYAML

func (op OpRetain) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a retain operation into YAML

func (*OpRetain) Type

func (op *OpRetain) Type() string

Type will return the type of operation

func (*OpRetain) UnmarshalJSON

func (op *OpRetain) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a retain operation

func (*OpRetain) UnmarshalYAML

func (op *OpRetain) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a retain operation

type RestructureOperator

type RestructureOperator struct {
	helper.TransformerOperator
	// contains filtered or unexported fields
}

RestructureOperator is an operator that can restructure incoming entries using operations

func (*RestructureOperator) Process

func (p *RestructureOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will process an entry with a restructure transformation.

func (*RestructureOperator) Transform

func (p *RestructureOperator) Transform(entry *entry.Entry) error

Transform will apply the restructure operations to an entry

type RestructureOperatorConfig

type RestructureOperatorConfig struct {
	helper.TransformerConfig `yaml:",inline"`

	Ops []Op `json:"ops" yaml:"ops"`
}

RestructureOperatorConfig is the configuration of a restructure operator

func NewRestructureOperatorConfig

func NewRestructureOperatorConfig(operatorID string) *RestructureOperatorConfig

NewRestructureOperatorConfig creates a new restructure operator config with default values

func (RestructureOperatorConfig) Build

Build will build a restructure operator from the supplied configuration

Jump to

Keyboard shortcuts

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