Documentation ¶
Overview ¶
Package mapping provides a parser for the full bloblang mapping spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assignment ¶
type Assignment interface {
Apply(value interface{}, ctx AssignmentContext) error
}
Assignment represents a way of assigning a queried value to something within an assignment context. This could be a Benthos message, a variable, a metadata field, etc.
type AssignmentContext ¶
type AssignmentContext struct { Maps map[string]query.Function Vars map[string]interface{} Meta types.Metadata Value *interface{} }
AssignmentContext contains references to all potential assignment destinations of a given mapping.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor is a parsed bloblang mapping that can be executed on a Benthos message.
func NewExecutor ¶
NewExecutor parses a bloblang mapping and returns an executor to run it, or an error if the parsing fails.
func (*Executor) Exec ¶
func (e *Executor) Exec(ctx query.FunctionContext) (interface{}, error)
Exec this function with a context struct.
func (*Executor) MapPart ¶
MapPart executes the bloblang mapping on a particular message index of a batch. The message is parsed as a JSON document in order to provide the mapping context. Returns an error if any stage of the mapping fails to execute.
A resulting mapped message part is returned, unless the mapping results in a query.Delete value, in which case nil is returned and the part should be discarded.