func Test_QueryPage(t *testing.T) { m := new(models.MonitorApp) params, num, err := m.QueryMonitorAppPage(1, 10) if err != nil { t.Error(err) } t.Log(num) t.Log(params) }
func (c *Collector) start() { m := new(models.MonitorApp) beego.Info("collector is running") apps, _, err := m.QueryMonitorAppPage(0, 10000) if err != nil { beego.Error(err) } for _, app := range apps { gm.NewLoopGoroutine(strconv.Itoa(app.Id), c.StartInterval, app) } }
func (this *MonitorAppController) MonitorAppList() { this.Data["xsrf_token"] = this.XsrfToken() m := new(models.MonitorApp) cnt, _ := models.CountObjects(m.Query()) pager := this.SetPaginator(this.pagesize, cnt) apps, num, err := m.QueryMonitorAppPage(pager.Offset(), this.pagesize) if err != nil { beego.Error(err) } beego.Info(num) beego.Info(apps) this.Data["apps"] = apps if beego.AppConfig.String("runmode") == "dev" { beego.Debug(apps) } beego.Info(this.Ctx.Request.RequestURI) this.View("index") }