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.