I\'m trying to create a self-reference in a (my)sql table using golang gorm. At the moment my code looks like this:
type Person struct { gorm.Model Name
Fortunately gorm have added lately this feature (reference: here).
In your case should be like this:
type Person struct { gorm.Model Name string Children []*Person `gorm:"many2many: children;association_jointable_foreignkey:children_id"` }