mapper

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

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 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