asset.go 1.0 KB

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