mapper

package
v0.9.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: BSD-3-Clause Imports: 14 Imported by: 39

Documentation

Index

Constants

View Source
const (
	//To do an array mapping from upstreaming, use @foreach.
	/*
			"input": {

		    "val" : {
		        "a" : "=$activity[blah].out",
		        "addresses": {
		            "@foreach($activity[blah].out2, i)":
		            {
		              "street"  : "=$.street",
		              "zipcode" : "9999",
		              "state"   : "=$activity[test].state",
		              "addresses2": {
		                  "@foreach($.addresses2)":{
		                        "street2"  : "=$loop[i].street2",
		                        "zipcode2" : "=$.zipcode",
		                        "state2"   : "=$activity[test].state"
		                	  }
		               	}
		            	}
		        	}
		    	}
			}

	*/
	FOREACH = "@foreach"
)

Variables

This section is empty.

Functions

func ConvertLegacyMappings

func ConvertLegacyMappings(mappings *LegacyMappings, resolver resolve.CompositeResolver) (input map[string]interface{}, output map[string]interface{}, err error)

func ConvertMappingValue

func ConvertMappingValue(mappingType string, mappingValue interface{}) (interface{}, error)

Deprecated

func HandleMappings

func HandleMappings(mappings []*LegacyMapping, resolver resolve.CompositeResolver) (map[string]interface{}, error)

func Insert

func Insert(slice []interface{}, index int, value interface{}) []interface{}

func IsIdentRune

func IsIdentRune(ch rune, i int) bool

func IsLiteral

func IsLiteral(value interface{}) bool

func NewObjectMapperFactory

func NewObjectMapperFactory(exprFactory expression.Factory) expression.Factory

func ResolvableExpr

func ResolvableExpr(expr string, resolver resolve.CompositeResolver) bool

func ToNewArray

func ToNewArray(mapping *LegacyArrayMapping, resolver resolve.CompositeResolver) (interface{}, error)

func ToNewArrayChildMapto

func ToNewArrayChildMapto(old string) string

Types

type ExprMapper

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

func (*ExprMapper) Apply

func (m *ExprMapper) Apply(inputScope data.Scope) (map[string]interface{}, error)

type ExprMapperFactory

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

func (*ExprMapperFactory) NewMapper

func (mf *ExprMapperFactory) NewMapper(mappings map[string]interface{}) (Mapper, error)

type Factory

type Factory interface {
	NewMapper(mappings map[string]interface{}) (Mapper, error)
}

func NewFactory

func NewFactory(resolver resolve.CompositeResolver) Factory

type LegacyArrayMapping

type LegacyArrayMapping struct {
	From   interface{}           `json:"from"`
	To     string                `json:"to"`
	Type   string                `json:"type"`
	Fields []*LegacyArrayMapping `json:"fields,omitempty"`
}

DEPRECATED

func ParseArrayMapping

func ParseArrayMapping(arrayDatadata interface{}) (*LegacyArrayMapping, error)

type LegacyMapping

type LegacyMapping struct {
	Type  interface{} `json:"type"`
	Value interface{} `json:"value"`
	MapTo string      `json:"mapTo"`
}

MappingDef is a simple structure that defines a mapping DEPRECATED

type LegacyMappings

type LegacyMappings struct {
	Input  []*LegacyMapping `json:"input,omitempty"`
	Output []*LegacyMapping `json:"output,omitempty"`
}

DEPRECATED

type Mapper

type Mapper interface {
	Apply(scope data.Scope) (map[string]interface{}, error)
}

Mapper is a constructs that maps values to a map

type MappingField

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

DEPRECATED, code from flogo-lib for map ref parser

func NewMappingField

func NewMappingField(fields []string) *MappingField

func ParseMappingField

func ParseMappingField(mRef string) (*MappingField, error)

func (*MappingField) Getfields

func (m *MappingField) Getfields() []string

func (*MappingField) Parser

func (m *MappingField) Parser() error

func (*MappingField) Start

func (m *MappingField) Start(jsonPath string) error

type ObjectMapper

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

func (*ObjectMapper) Eval

func (am *ObjectMapper) Eval(inputScope data.Scope) (interface{}, error)

type ObjectMapperFactory

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

func (*ObjectMapperFactory) NewExpr

func (am *ObjectMapperFactory) NewExpr(value string) (expression.Expr, error)

func (*ObjectMapperFactory) NewObjectMapper

func (am *ObjectMapperFactory) NewObjectMapper(value interface{}) (expression.Expr, error)

Jump to

Keyboard shortcuts

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