MCPcopy Create free account
hub / github.com/devfeel/mapper / Mapper

Method Mapper

mapper_object.go:38–48  ·  view source on GitHub ↗

Mapper map and set value from struct fromObj to toObj not support auto register struct

(fromObj, toObj interface{})

Source from the content-addressed store, hash-verified

36// Mapper map and set value from struct fromObj to toObj
37// not support auto register struct
38func (dm *mapperObject) Mapper(fromObj, toObj interface{}) error {
39 fromElem := reflect.ValueOf(fromObj).Elem()
40 toElem := reflect.ValueOf(toObj).Elem()
41 if fromElem == dm.ZeroValue {
42 return errors.New("from obj is not legal value")
43 }
44 if toElem == dm.ZeroValue {
45 return errors.New("to obj is not legal value")
46 }
47 return dm.elemMapper(fromElem, toElem)
48}
49
50// AutoMapper mapper and set value from struct fromObj to toObj
51// support auto register struct

Callers 1

AutoMapperMethod · 0.95

Calls 1

elemMapperMethod · 0.95

Tested by

no test coverage detected