edb_data_pb.go 672 B

123456789101112131415161718192021222324252627
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type EdbDataPb struct {
  7. EdbDataId int `orm:"column(edb_data_id);pk"`
  8. EdbInfoId int
  9. EdbCode string
  10. DataTime string
  11. Value float64
  12. Status int
  13. CreateTime time.Time
  14. ModifyTime time.Time
  15. Ticker string
  16. Field string
  17. DataTimestamp int64
  18. }
  19. func GetEdbDataPbMaxOrMinDate(edbCode string) (min_date, max_date string, err error) {
  20. o := orm.NewOrmUsingDB("data")
  21. sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_pb WHERE edb_code=? `
  22. err = o.Raw(sql, edbCode).QueryRow(&min_date, &max_date)
  23. return
  24. }