edb_data_pb.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package data_manage
  2. //type EdbDataPb struct {
  3. // EdbDataId int `orm:"column(edb_data_id);pk" gorm:"primaryKey"`
  4. // EdbInfoId int
  5. // EdbCode string
  6. // DataTime string
  7. // Value float64
  8. // Status int
  9. // CreateTime time.Time
  10. // ModifyTime time.Time
  11. // Ticker string
  12. // Field string
  13. // DataTimestamp int64
  14. //}
  15. //func AddEdbDataPb(items []*EdbDataPb) (err error) {
  16. // o := global.DbMap[utils.DbNameIndex]
  17. // err = o.CreateInBatches(items, utils.MultiAddNum).Error
  18. // return
  19. //}
  20. //func ModifyEdbDataPb(edbInfoId int64, edbCode, dataTime string, value float64) (err error) {
  21. // o := global.DbMap[utils.DbNameIndex]
  22. // sql := ` UPDATE edb_data_pb SET edb_info_id=?,value=?,status=1,modify_time=NOW() WHERE edb_code=? AND data_time=? `
  23. // err = o.Exec(sql, edbInfoId, value, edbCode, dataTime).Error
  24. // return
  25. //}
  26. //func ModifyEdbDataPbStatus(edbInfoId int64, edbCode string) (err error) {
  27. // o := global.DbMap[utils.DbNameIndex]
  28. // sql := ` UPDATE edb_data_pb SET edb_info_id=?, status=1,modify_time=NOW() WHERE edb_code=? `
  29. // err = o.Exec(sql, edbInfoId, edbCode).Error
  30. // return
  31. //}
  32. //func GetEdbDataPbCount(edbCode, dataTime string) (count int, err error) {
  33. // o := global.DbMap[utils.DbNameIndex]
  34. // sql := ` SELECT COUNT(1) AS count FROM edb_data_pb WHERE edb_code=? AND data_time=? `
  35. // err = o.Raw(sql, edbCode, dataTime).Scan(&count).Error
  36. // return
  37. //}
  38. //func GetEdbDataPbMaxOrMinDate(edbInfoId int) (min_date, max_date string, err error) {
  39. // o := global.DbMap[utils.DbNameIndex]
  40. // sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_pb WHERE edb_info_id=? `
  41. // err = o.Raw(sql, edbInfoId).Row().Scan(&min_date, &max_date)
  42. // return
  43. //}