package entity import ( "github.com/shopspring/decimal" ) type Asset struct { MysqlBaseModel UserId int64 `json:"userId" gorm:"uniqueIndex:idx_address_coin;comment:用户ID;NOT NULL"` // uniqueIndex 组合唯一约束+索引 index 索引 Uid string `json:"uid" gorm:"index;type:varchar(64);comment:交易所ID:;"` Symbol string `json:"symbol" gorm:"uniqueIndex:idx_address_coin;comment:币种名;type:VARCHAR(20)"` Balance decimal.Decimal `json:"balance" gorm:"type:decimal(25,8); default:0;comment:净资产;"` Frozen decimal.Decimal `json:"frozen" gorm:"type:decimal(25,8);default:0;comment:冻结资产"` TotalAmount decimal.Decimal `json:"totalAmount" gorm:"type:decimal(25,8);default:0;comment:总资产"` Version int64 `json:"version" gorm:"default:0;type:int;comment:事务版本;"` } func (*Asset) TableName() string { return ModelPrefix + "asset" } func (*Asset) Comment() string { return "用户资产信息" } func NewAsset() *Asset { return &Asset{} }