goplantuml
goplantuml copied to clipboard
Abnormal Display in Interface Implementation via Struct Embedding
// interface
type IPropertySource interface {
EqualsName(ps IPropertySource) bool
GetName() string
GetSource() map[string]any
GetProperty(key string) any
ContainsProperty(key string) bool
}
// 部分实现
type NamedPropertySource struct {
Name string
}
func (n *NamedPropertySource) GetName() string {
return n.Name
}
func (n *NamedPropertySource) EqualsName(ps IPropertySource) bool {
return n.Name == ps.GetName()
}
type PropertySource struct {
NamedPropertySource // 结构体嵌入
Source map[string]any
}
func (p *PropertySource) GetSource() map[string]any {
return p.Source
}
func (p *PropertySource) GetProperty(key string) any {
return p.Source[key]
}
func (p *PropertySource) ContainsProperty(key string) bool {
_, ok := p.Source[key]
return ok
}
Expected PropertySource to implement interface IPropertySource
But the actual display: