E0503: A Schema field behind a pointer
The orm calls Schema once, on a zero value of the model, so a pointer the model holds is nil there: a field reached through it (&p.Meta.Note with Meta an embedded *Meta) can't be named, and Schema panics. Reported by every query of the model, orm.Check and vukavet.
Wrong
go
type Post struct {
*Stamps
Title string
}
func (p *Post) Schema(s *orm.Schema) {
s.Field(&p.Created, orm.Datetime{DefaultNow: true})
}Right
go
type Post struct {
Stamps
Title string
}
func (p *Post) Schema(s *orm.Schema) {
s.Field(&p.Created, orm.Datetime{DefaultNow: true})
}