review code.
This commit is contained in:
32
internal/models/collect_assets.go
Normal file
32
internal/models/collect_assets.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// AssetSnapshot 资产快照数据库模型
|
||||
type CollectorAssets struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;comment:主键ID"`
|
||||
AccountID string `json:"account_id" gorm:"type:varchar(50);not null;index;comment:账户ID"`
|
||||
Ymd int `json:"ymd" gorm:"not null;index;comment:采集日期(年月日数字格式,如20260407)"`
|
||||
Cash float64 `json:"cash" gorm:"type:decimal(15,2);not null;default:0;comment:可用资金"`
|
||||
FrozenCash float64 `json:"frozen_cash" gorm:"type:decimal(15,2);not null;default:0;column:frozen_cash;comment:冻结资金"`
|
||||
MarketValue float64 `json:"market_value" gorm:"type:decimal(15,2);not null;default:0;column:market_value;comment:持仓市值"`
|
||||
Profit float64 `json:"profit" gorm:"type:decimal(15,2);not null;default:0;comment:当日盈亏"`
|
||||
TotalAsset float64 `json:"total_asset" gorm:"type:decimal(15,2);not null;default:0;column:total_asset;comment:总资产"`
|
||||
CollectedAt time.Time `json:"collected_at" gorm:"not null;index;comment:数据采集时间"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;comment:记录创建时间"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:软删除时间"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CollectorAssets{})
|
||||
}
|
||||
|
||||
// TableName 设置表名
|
||||
func (CollectorAssets) TableName() string {
|
||||
return "collector_assets"
|
||||
}
|
||||
Reference in New Issue
Block a user