package test_orm
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"beego_project/models"
"fmt"
)
type TestOrmChap04Controller struct {
beego.Controller
}
func (t *TestOrmChap04Controller) Get() {
o := orm.NewOrm()
qs := o.QueryTable("article")
//article := models.Article{}
//qs.Filter("title__exact","ZhiliaO").One(&article,"title","author")
//qs.Filter("title__exact","ZhiliaO").Filter("author__exact","zhiliao").One(&article,"Title","Author")
articles := []models.Article{}
// 100条,2条不想要,想要的是98,
//qs.Filter("title__exact","西游记").All(&articles)
//qs.Exclude("title__exact","zhiliao").All(&articles)
//qs.Exclude("read_count__isnull",true).All(&articles)
//qs.Limit(3,1).All(&articles)
//qs.Limit(3).Offset