transform

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithJsonInput

func WithJsonInput() goTemplateOption

func WithStringInput

func WithStringInput() goTemplateOption

func WithTemplate

func WithTemplate(tmp *template.Template) goTemplateOption

func WithTemplatePattern

func WithTemplatePattern(pattern string) goTemplateOption

func WithYamlInput

func WithYamlInput() goTemplateOption

Types

type Func

type Func func(input []byte) ([][]byte, error)

func (Func) Transform

func (tf Func) Transform(input []byte) ([][]byte, error)

type GoTemplateConfig

type GoTemplateConfig struct {
	Format  string `yaml:"format"`
	Pattern string `yaml:"pattern"`
}

type Map

type Map func(input []byte) ([]byte, error)

func (Map) Transform

func (tm Map) Transform(input []byte) ([][]byte, error)

type Plugin

type Plugin struct {
	Transformers []Transformer
}

func New

func New() *Plugin

func (*Plugin) Config

func (tp *Plugin) Config(config []byte) error

func (*Plugin) GetInputSchema

func (tp *Plugin) GetInputSchema() ([]byte, error)

func (*Plugin) Work

func (tp *Plugin) Work(ctx context.Context, input []byte, yield func(elem []byte) error) error

type Transformer

type Transformer interface {
	// Transform takes a value and returns a transformed version of it.
	Transform(input []byte) ([][]byte, error)
}

func Base64Decode

func Base64Decode() Transformer

func GoTemplate

func GoTemplate[OPT goTemplateOption](opt ...OPT) (Transformer, error)

func GoTemplateWithConfig

func GoTemplateWithConfig(config GoTemplateConfig) (Transformer, error)

func InsertString

func InsertString(insert string) Transformer

func NewTransform

func NewTransform(name string, config yaml.Node) (Transformer, error)

func Regex

func Regex(regexpPattern string, n int) (Transformer, error)

func Split

func Split(sep string) Transformer

Jump to

Keyboard shortcuts

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