QueryTable 接口

2021/8/1 23:07:35

本文主要是介绍QueryTable 接口,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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


这篇关于QueryTable 接口的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程