MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / diffMember

Function diffMember

Source/componentdiff.go:540–577  ·  view source on GitHub ↗
(path string, memberA ComponentDefinitionMember, memberB ComponentDefinitionMember)

Source from the content-addressed store, hash-verified

538}
539
540func diffMember(path string, memberA ComponentDefinitionMember, memberB ComponentDefinitionMember) ([]ComponentDiffAttributeChange, error) {
541 changes := make([]ComponentDiffAttributeChange, 0)
542
543 pathA := path + "/member[@name='" + memberA.Name + "']"
544 if (memberA.Type != memberB.Type) {
545 var change ComponentDiffAttributeChange
546 change.Path = pathA + "/type"
547 change.OldValue = memberA.Type
548 change.NewValue = memberB.Type
549 changes = append(changes, change)
550 }
551
552 if (memberA.Class != memberB.Class) {
553 var change ComponentDiffAttributeChange
554 change.Path = pathA + "/class"
555 change.OldValue = memberA.Class
556 change.NewValue = memberB.Class
557 changes = append(changes, change)
558 }
559
560 if (memberA.Columns != memberB.Columns) {
561 var change ComponentDiffAttributeChange
562 change.Path = pathA + "/columns"
563 change.OldValue = string(memberA.Columns)
564 change.NewValue = string(memberB.Columns)
565 changes = append(changes, change)
566 }
567
568 if (memberA.Rows != memberB.Rows) {
569 var change ComponentDiffAttributeChange
570 change.Path = pathA + "/rows"
571 change.OldValue = string(memberA.Rows)
572 change.NewValue = string(memberB.Rows)
573 changes = append(changes, change)
574 }
575
576 return changes, nil
577}
578
579func diffStruct(path string, structA ComponentDefinitionStruct, structB ComponentDefinitionStruct) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) {
580 changes := make([]ComponentDiffAttributeChange, 0)

Callers 1

diffStructFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected