mapper

package
Version: v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: BSD-3-Clause Imports: 7 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapObject

func MapObject(mappingObject interface{}, scope data.Scope, resolver data.Resolver) (result interface{}, err error)

func NewAssignExpr

func NewAssignExpr(assignTo string, value interface{}) data.Expr

func NewBasicMapper

func NewBasicMapper(mapperDef *data.MapperDef, resolver data.Resolver) data.Mapper

NewBasicMapper creates a new BasicMapper with the specified mappings

func NewMapperDefFromAnyArray

func NewMapperDefFromAnyArray(mappings []interface{}) (*data.MapperDef, error)

func SetFactory

func SetFactory(factory Factory)

Types

type BasicMapper

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

BasicMapper is a simple object holding and executing mappings

func (*BasicMapper) Apply

func (m *BasicMapper) Apply(inputScope data.Scope, outputScope data.Scope) error

Apply executes the mappings using the values from the input scope and puts the results in the output scope

return error

func (*BasicMapper) Mappings

func (m *BasicMapper) Mappings() []*data.MappingDef

Mappings gets the mappings of the BasicMapper

func (*BasicMapper) UpdateMapping

func (m *BasicMapper) UpdateMapping() error

type BasicMapperFactory

type BasicMapperFactory struct {
}

func (*BasicMapperFactory) NewMapper

func (mf *BasicMapperFactory) NewMapper(mapperDef *data.MapperDef, resolver data.Resolver) data.Mapper

func (*BasicMapperFactory) NewUniqueMapper

func (mf *BasicMapperFactory) NewUniqueMapper(ID string, mapperDef *data.MapperDef, resolver data.Resolver) data.Mapper

type Factory

type Factory interface {
	// NewMapper creates a new data.Mapper from the specified data.MapperDef
	NewMapper(mapperDef *data.MapperDef, resolver data.Resolver) data.Mapper

	// NewUniqueMapper creates a unique data.Mapper from the specified data.MapperDef
	// the ID can be used to facilitate use precompiled mappers
	NewUniqueMapper(ID string, mapperDef *data.MapperDef, resolver data.Resolver) data.Mapper
}

func GetFactory

func GetFactory() Factory

Jump to

Keyboard shortcuts

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