Skip to content

E0129: Attributes and a hand-written schema method ​

A struct embedding orm.Base or ui.Live declares its attributes in one method, Schema or LiveSchema. Vuka writes that method from the attributes on the struct's fields and the hooks on its methods, so the type can't declare it too.

Wrong ​

vuka
type Post struct {
	orm.Base
	Title string @orm.Char{Max: 200}
}

func (p *Post) Schema(s *orm.Schema) {
	s.Model(orm.Meta{Table: "posts"})
}
vuka
type Post struct {
	orm.Base @orm.Meta{Table: "posts"}
	Title string @orm.Char{Max: 200}
}

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.