fix schema

This commit is contained in:
2026-05-01 17:47:58 +08:00
parent 5673e5c6ca
commit 4f4781aad3
5 changed files with 33 additions and 33 deletions

View File

@@ -2,8 +2,8 @@ package schema
import "strconv"
// DatasetStockIndicator 每日基本面指标(采用 dataset/stock 的 decimal 定义,与采集端迁移一致)。
type DatasetStockIndicator struct {
// DatasetIndicator 每日基本面指标(采用 dataset/stock 的 decimal 定义,与采集端迁移一致)。
type DatasetIndicator struct {
ID uint `gorm:"primarykey;autoIncrement"`
TsCode string `gorm:"type:varchar(20);not null;index:si_ts_code;uniqueIndex:un_si_code_date;comment:股票代码" json:"ts_code"`
TradeDate int `gorm:"index:si_trade_date;uniqueIndex:un_si_code_date;comment:交易日期" json:"trade_date"`
@@ -26,12 +26,12 @@ type DatasetStockIndicator struct {
Roe float64 `gorm:"type:decimal(20,4);comment:ROE(%) 净利润/股本"`
}
func (DatasetStockIndicator) TableName() string {
return "dataset_stock_indicator"
func (DatasetIndicator) TableName() string {
return "dataset_indicator"
}
// Key 业务主键ts_code + 交易日。
func (s *DatasetStockIndicator) Key() string {
func (s *DatasetIndicator) Key() string {
if s.TsCode == "" && s.TradeDate == 0 {
return ""
}
@@ -39,11 +39,11 @@ func (s *DatasetStockIndicator) Key() string {
}
// HasTotalMV 总市值是否已填充(大于 0
func (s *DatasetStockIndicator) HasTotalMV() bool {
func (s *DatasetIndicator) HasTotalMV() bool {
return s.TotalMv > 0
}
// HasCircMV 流通市值是否已填充。
func (s *DatasetStockIndicator) HasCircMV() bool {
func (s *DatasetIndicator) HasCircMV() bool {
return s.CircMv > 0
}