package data_manage import ( "github.com/beego/beego/v2/client/orm" "time" ) type BaseFromTradeShanghaiIndex struct { BaseFromTradeShangHaiIndexId int `orm:"column(base_from_trade_shanghai_index_id);pk"` Rank int DealShortName string DealName string DealCode string DealValue string DealChange string BuyShortName string BuyName string BuyCode string BuyValue string BuyChange string SoldShortName string SoldName string SoldCode string SoldValue string SoldChange string Frequency string ClassifyName string ClassifyType string CreateTime time.Time ModifyTime time.Time DataTime string } func GetFirstBaseFromTradeIndexByDate(exchange string) (item *BaseFromTradeShanghaiIndex, err error) { o := orm.NewOrmUsingDB("data") sql := "SELECT * FROM base_from_trade_" + exchange + "_index where rank < 50 order by data_time asc" err = o.Raw(sql).QueryRow(&item) return }