walkMatches iterates through the attributes of source and looks for attributes with identical names in target. walkMatches calls the walker function for each pair of matched attributes. Both source and target must be objects or else walkMatches panics.
(source, target *expr.AttributeExpr, walker func(src, tgt *expr.MappedAttributeExpr, srcc, tgtc *expr.AttributeExpr, n string))
| 686 | // function for each pair of matched attributes. Both source and target must be |
| 687 | // objects or else walkMatches panics. |
| 688 | func walkMatches(source, target *expr.AttributeExpr, walker func(src, tgt *expr.MappedAttributeExpr, srcc, tgtc *expr.AttributeExpr, n string)) { |
| 689 | srcMatt := expr.NewMappedAttributeExpr(source) |
| 690 | tgtMatt := expr.NewMappedAttributeExpr(target) |
| 691 | srcObj := expr.AsObject(srcMatt.Type) |
| 692 | tgtObj := expr.AsObject(tgtMatt.Type) |
| 693 | for _, nat := range *srcObj { |
| 694 | if att := tgtObj.Attribute(nat.Name); att != nil { |
| 695 | walker(srcMatt, tgtMatt, nat.Attribute, att, nat.Name) |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | // transformHelperName returns the transformation function name to initialize a |
| 701 | // target user type from an instance of a source user type. |
no test coverage detected