field

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package field implements a bloblang interpolation function templating syntax used in some dynamic fields within Benthos. Only the query (right-hand side) part of the bloblang spec is supported within interpolation functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expression

type Expression interface {
	// Bytes returns a byte slice representing the expression resolved for a
	// message
	// of a batch.
	Bytes(index int, msg Message) []byte

	// BytesLegacy is DEPRECATED - Instructs deprecated functions to disregard
	// index information.
	// TODO V4: Remove this.
	BytesLegacy(index int, msg Message) []byte

	// BytesEscaped returns a byte slice representing the expression resolved
	// for a message of a batch with the contents of resolved expressions
	// escaped.
	BytesEscaped(index int, msg Message) []byte

	// BytesEscapedLegacy is DEPRECATED - Instructs deprecated functions to
	// disregard index information.
	// TODO V4: Remove this.
	BytesEscapedLegacy(index int, msg Message) []byte

	// String returns a string representing the expression resolved for a
	// message of a batch.
	String(index int, msg Message) string

	// StringLegacy is DEPRECATED - Instructs deprecated functions to disregard
	// index information.
	// TODO V4: Remove this.
	StringLegacy(index int, msg Message) string
}

Expression represents a Benthos dynamic field expression, used to configure string fields where the contents should change based on the contents of messages and other factors.

Each function here resolves the expression for a particular message of a batch, this is why an index is expected.

func New

func New(expr string) (Expression, error)

New attempts to parse and create an expression from a string. If the expression is invalid an error is returned.

type Message

type Message interface {
	Get(p int) types.Part
	Len() int
}

Message is an interface type to be given to a function interpolator, it allows the function to resolve fields and metadata from a message.

Jump to

Keyboard shortcuts

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