pool: Reddo component-like fields

This commit is contained in:
Tom Wiesing 2022-12-22 13:49:05 +01:00
parent 99983ee6db
commit 337a5fbeba
No known key found for this signature in database
48 changed files with 291 additions and 163 deletions

View file

@ -19,6 +19,9 @@ type PoolAnalyticsComponent struct {
CFields map[string]string // fields with type C for which C implements component
IFields map[string]string // fields []I where I is an interface that implements component
DCFields map[string]string // fields of the auto field with type C for which C implements component
DIFields map[string]string // fields of the auto field []I where I is an interface that implements component
Methods map[string]string // Method signatures of type
}
type PoolAnalyticsGroup struct {
@ -61,11 +64,18 @@ func (context *PoolContext[Component]) anal(anal *PoolAnalytics, groups []reflec
anal.Components[meta.Name].CFields = collection.MapValues(meta.CFields, func(key string, tp reflect.Type) string {
return nameOf(tp.Elem())
})
anal.Components[meta.Name].DCFields = collection.MapValues(meta.DCFields, func(key string, tp reflect.Type) string {
return nameOf(tp.Elem())
})
anal.Components[meta.Name].IFields = collection.MapValues(meta.IFields, func(key string, iface reflect.Type) string {
ifaces = append(ifaces, iface)
return nameOf(iface)
})
anal.Components[meta.Name].DIFields = collection.MapValues(meta.DIFields, func(key string, iface reflect.Type) string {
ifaces = append(ifaces, iface)
return nameOf(iface)
})
}
// and analyze all ifaces