o := orm.NewOrm()

        // 查询全部记录

        var students []models.Student  //查询的结果是集合的话,这里需要加上[]

        _, qs := o.QueryTable("Student").All(&students)

if qs == nil{

for _, student := range students {

fmt.Println(student)

}

}

c.Data["object"] = students

        //查询单个记录,根据某个字段查询

        var student models.Student

        qs := o.QueryTable("Student").Filter("Id", 1).One(&student)

        if qs == nil{

    fmt.Println(student)

}