-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I had a case earlier which made me pull my hair for a full day and half :
Let's say we have the following structs :
type Entity struct {
ID int64 `db:"id"`
Service *Service
}
type Service struct {
Entity *Entity
}
func NewEntity(id int64) *Entity {
e := &Entity{}
e.Service = &Service{}
e.Service.Entity = e
return e
}
When StructScan
ing, the function tries to establish a field map by exploring the tree of embedded types of the struct. I my case, the exploration never end because of the pointers.
This issue bring the following question to my mind : what is the point of exploring non-embedded fields ? It seem rather non-semantic to me…
And independantly, why making a field map and not simply look for the fields as needed when scanning ?
Metadata
Metadata
Assignees
Labels
No labels