base_from_changes_visitors_covid.go 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // 谷歌出行指数
  7. type BaseFromChangesVisitorsCovid struct {
  8. Id uint64 `orm:"column(id);pk"` //序号
  9. Entity string `orm:"column(entity)"` //国家
  10. Code string `orm:"column(code)"` //国家编码
  11. EdbCode string `orm:"column(edb_code)"` //指标ID
  12. Day time.Time `orm:"column(day)"` //统计的日期
  13. RetailAndRecreation string `orm:"column(retail_and_recreation)"`
  14. GroceryAndPharmacy string `orm:"column(grocery_and_pharmacy)"`
  15. Residential string `orm:"column(residential)"`
  16. TransitStations string `orm:"column(transit_stations)"`
  17. Parks string `orm:"column(parks)"`
  18. Workplaces string `orm:"column(workplaces)"`
  19. Total string `orm:"column(total)"`
  20. CreateTime time.Time `orm:"auto_now_add;column(create_time)"` //创建时间
  21. ModifyTime time.Time `orm:"auto_now_add;column(modify_time)"` //修改时间
  22. }
  23. func GetChangesVisitorsCovid(startDate, endDate string) (list []*BaseFromChangesVisitorsCovid, err error) {
  24. o := orm.NewOrm()
  25. sql := `SELECT * FROM base_from_changes_visitors_covid WHERE create_time>=? AND create_time<=? `
  26. _, err = o.Raw(sql, startDate, endDate).QueryRows(&list)
  27. return
  28. }