package data_manage import ( "eta/eta_api/global" "eta/eta_api/utils" "time" ) func GetEdbDataManualMaxOrMinDate(edbCode string) (min_date, max_date string, err error) { //o := orm.NewOrmUsingDB("data") //sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_manual WHERE edb_code=? ` //err = o.Raw(sql, edbCode).QueryRow(&min_date, &max_date) sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_manual WHERE edb_code=? ` var maxAndMinDate MaxAndMinDate err = global.DbMap[utils.DbNameIndex].Raw(sql, edbCode).First(&maxAndMinDate).Error if err != nil { return } min_date = maxAndMinDate.MinDate.Format(utils.FormatDate) max_date = maxAndMinDate.MaxDate.Format(utils.FormatDate) return } type ManualEdbdata struct { TradeCode string `gorm:"column:TRADE_CODE;primaryKey" description:"指标编码"` //TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标编码"` Dt string `orm:"column(DT)" description:"日期"` Close string `orm:"column(CLOSE)" description:"值"` ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"` }