transformation

package
v0.1.3-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindJmespath = "jmespath"
	KindJsonata  = "jsonata"
)

Variables

View Source
var (
	ErrNotAMap = errors.New("interface{} is not a struct")
)
View Source
var (
	ErrUnknownTransformer = errors.New("unkown transformer")
)

Functions

This section is empty.

Types

type JmesTransformer

type JmesTransformer struct {
	Expression string `hcl:"expression"`
	// contains filtered or unexported fields
}

func (*JmesTransformer) Initialize

func (jt *JmesTransformer) Initialize() (err error)

func (*JmesTransformer) Transform

func (jt *JmesTransformer) Transform(ctx context.Context, data *structpb.Struct) (*structpb.Struct, error)

type JsonataTransformer

type JsonataTransformer struct {
	Expression string `hcl:"expression"`
	// contains filtered or unexported fields
}

func (*JsonataTransformer) Initialize

func (jt *JsonataTransformer) Initialize() (err error)

func (*JsonataTransformer) Transform

func (jt *JsonataTransformer) Transform(ctx context.Context, data *structpb.Struct) (*structpb.Struct, error)

type Transformation

type Transformation struct {
	ID            string
	Kind          string
	Subscriptions []string
	Broker        pubsub.Broker
	Subscriber    pubsub.Subscriber

	BufferSize int
	// contains filtered or unexported fields
}

func New

func New(id, kind string, bufferSize int, subscriptions []string, transformer TransformerImpl) (*Transformation, error)

func (*Transformation) Init

func (t *Transformation) Init() (pubsub.Broker, error)

func (*Transformation) Process

func (t *Transformation) Process(ctx context.Context) error

type TransformerImpl

type TransformerImpl interface {
	Transform(ctx context.Context, data *structpb.Struct) (*structpb.Struct, error)
	Initialize() error
}

func HclImpl

func HclImpl(kind string, body hcl.Body) (TransformerImpl, hcl.Diagnostics)

Jump to

Keyboard shortcuts

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