Skip to content

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})
}
go
type Post struct {
	Stamps
	Title string
}

func (p *Post) Schema(s *orm.Schema) {
	s.Field(&p.Created, orm.Datetime{DefaultNow: true})
}

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.