Documentation ¶
Overview ¶
Package expression implements a Benthos dynamic field expression and the parser combinators for parsing them.
Index ¶
- type Expression
- func (e *Expression) Bytes(index int, msg Message) []byte
- func (e *Expression) BytesEscaped(index int, msg Message) []byte
- func (e *Expression) BytesEscapedLegacy(index int, msg Message) []byte
- func (e *Expression) BytesLegacy(index int, msg Message) []byte
- func (e *Expression) String(index int, msg Message) string
- func (e *Expression) StringLegacy(index int, msg Message) string
- type Message
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression represents a dynamic Benthos field expression.
func Parse ¶
func Parse(expr string) (*Expression, error)
Parse a string into a Benthos dynamic field expression.
func (*Expression) Bytes ¶
func (e *Expression) Bytes(index int, msg Message) []byte
Bytes returns a byte slice representing the expression resolved for a message of a batch.
func (*Expression) BytesEscaped ¶
func (e *Expression) BytesEscaped(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.
func (*Expression) BytesEscapedLegacy ¶
func (e *Expression) BytesEscapedLegacy(index int, msg Message) []byte
BytesEscapedLegacy is DEPRECATED - Instructs deprecated functions to disregard index information. TODO V4: Remove this.
func (*Expression) BytesLegacy ¶
func (e *Expression) BytesLegacy(index int, msg Message) []byte
BytesLegacy is DEPRECATED - Instructs deprecated functions to disregard index information. TODO V4: Remove this.
func (*Expression) String ¶
func (e *Expression) String(index int, msg Message) string
String returns a string representing the expression resolved for a message of a batch.
func (*Expression) StringLegacy ¶
func (e *Expression) StringLegacy(index int, msg Message) string
StringLegacy is DEPRECATED - Instructs deprecated functions to disregard index information. TODO V4: Remove this.
type Message ¶
Message is an interface type to be given to a function interpolator, it allows the function to resolve fields and metadata from a message.
type Type ¶
type Type 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 }
Type 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.