package models import ( "time" "gorm.io/gorm" ) // Stock 存储股票基础信息。 type Stock struct { ID string `json:"id" gorm:"type:uuid;primaryKey;default:gen_random_uuid()"` TsCode string `json:"ts_code" gorm:"size:32;not null;uniqueIndex"` Symbol string `json:"symbol" gorm:"size:32;not null;index"` Name string `json:"name" gorm:"size:128"` Area string `json:"area" gorm:"size:64"` Industry string `json:"industry" gorm:"size:64"` Fullname string `json:"fullname" gorm:"size:256"` Enname string `json:"enname" gorm:"size:256"` Cnspell string `json:"cnspell" gorm:"size:64"` Market string `json:"market" gorm:"size:16"` Exchange string `json:"exchange" gorm:"size:16;index"` CurrType string `json:"curr_type" gorm:"size:16"` ListStatus string `json:"list_status" gorm:"size:8"` ListDate string `json:"list_date" gorm:"size:16"` DelistDate string `json:"delist_date" gorm:"size:16"` IsHs string `json:"is_hs" gorm:"size:8"` ActName string `json:"act_name" gorm:"size:128"` ActEntType string `json:"act_ent_type" gorm:"size:64"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // AutoMigrateStocks 迁移股票基础信息表。 func AutoMigrateStocks(db *gorm.DB) error { return db.AutoMigrate(&Stock{}) }