1 package model 2 3 type Category struct { 4 ID int 5 Parent *Category 6 Sort int 7 Name string 8 Description string 9 Boards []*Board `diff:"-"` 10 Categories []*Category `diff:"-"` 11 } 12 13 func (c *Category) HasBoard(id int) bool { 14 for _, b := range c.Boards { 15 if b.ID == id { 16 return true 17 } 18 } 19 return false 20 } 21