get all categories
(status ...bool)
| 83 | |
| 84 | // get all categories |
| 85 | func (this *Category) GetAll(status ...bool) (count int64, categories []Category) { |
| 86 | q := orm.NewOrm().QueryTable(this) |
| 87 | if len(status) > 0 { |
| 88 | q = q.Filter("status", status[0]) |
| 89 | } |
| 90 | count, _ = q.OrderBy("sort").All(&categories) |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | func (this *Category) GetCategoriesById(id ...interface{}) (cates []Category, err error) { |
| 95 | if len(id) == 0 { |