mapper

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mapper implements ways of splicing and mapping batches of messages so that their derivative parts can be processed individually and merged back into the original batch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptSetConditions

func OptSetConditions(conditions []types.Condition) func(*Type)

OptSetConditions sets the conditions used by this type.

func OptSetLogger

func OptSetLogger(l log.Modular) func(*Type)

OptSetLogger sets the logger used by this type.

func OptSetOptReqMap

func OptSetOptReqMap(m map[string]string) func(*Type)

OptSetOptReqMap sets the optional request map used by this type.

func OptSetOptResMap

func OptSetOptResMap(m map[string]string) func(*Type)

OptSetOptResMap sets the optional response map used by this type.

func OptSetReqMap

func OptSetReqMap(m map[string]string) func(*Type)

OptSetReqMap sets the mandatory request map used by this type.

func OptSetResMap

func OptSetResMap(m map[string]string) func(*Type)

OptSetResMap sets the mandatory response map used by this type.

func OptSetStats

func OptSetStats(s metrics.Type) func(*Type)

OptSetStats sets the metrics aggregator used by this type.

Types

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type contains conditions and maps for transforming a batch of messages into a subset of request messages, and mapping results from those requests back into the original message batch.

func New

func New(opts ...func(*Type)) (*Type, error)

New creates a new mapper Type.

func (*Type) MapRequests

func (t *Type) MapRequests(payload types.Message) (types.Message, []int, error)

MapRequests takes a single payload (of potentially multiple parts, where parts can potentially be nil) and attempts to create a new payload of mapped messages. Also returns an array of message part indexes that were skipped due to either failed conditions or being empty.

func (*Type) MapResponses

func (t *Type) MapResponses(payload, response types.Message) error

MapResponses attempts to merge a batch of responses with original payloads as per the response map.

The count of parts within the response message must match the original payload. If parts were removed from the enrichment request the original contents must be interlaced back within the response object before calling the overlay.

func (*Type) TargetsProvided

func (t *Type) TargetsProvided() []string

TargetsProvided returns a list of dot paths that this mapper provides.

func (*Type) TargetsUsed

func (t *Type) TargetsUsed() []string

TargetsUsed returns a list of dot paths that this mapper depends on.

Jump to

Keyboard shortcuts

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