Understand GoPlantUML relationship types
masterGoPlantUML identifies two primary types of relationships in Go code:
- Interface Implementation: When a struct implements all methods of an interface with matching signatures, an
extendsassociation (represented by<|--in PlantUML) is created. - Type Composition: When a struct contains another type as a field, a composition or aggregation relationship is created (represented by
*--oro--in PlantUML).
Example Logic:
MyStruct1implementsMyInterface$\rightarrow$MyInterface <|-- MyStruct1(extends).MyStruct2containsMyStruct1as an embedded field $\rightarrow$MyStruct1 *-- MyStruct2(composition).MyStruct3containsMyStruct1as a named field $\rightarrow$MyStruct3 o-- MyStruct1(aggregation/association).