Documentation
¶
Overview ¶
Package bloblang is DEPRECATED. Please use ./public/bloblang instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field interface {
// Bytes returns a byte slice representing the expression resolved for a
// message of a batch.
Bytes(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
}
Field 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.
type Mapping ¶
type Mapping interface {
// QueryPart executes a Bloblang mapping and expects a boolean result, which
// is returned. If the execution fails or the result is not boolean an error
// is returned.
//
// Bloblang is able to query other messages of a batch, and therefore this
// function takes a message batch and index rather than a single message
// part argument.
QueryPart(index int, msg Message) (bool, error)
// MapPart executes a Bloblang mapping on a message part and returns a new
// resulting part, or an error if the execution fails.
//
// Bloblang is able to query other messages of a batch, and therefore this
// function takes a message batch and index rather than a single message
// part argument.
MapPart(index int, msg Message) (types.Part, error)
}
Mapping is a parsed Bloblang mapping.
func NewMapping ¶
NewMapping attempts to parse and create a Bloblang mapping from a string. If the mapping was read from a file the path should be provided in order to resolve relative imports, otherwise the path can be left empty.
When a parsing error occurs the returned error may be a *parser.Error type, which allows you to gain positional and structured error messages.