package good import "time" type Goods struct { GID string `gorm:"column:gid"` Stock int `gorm:"column:stock"` StartTime time.Time `gorm:"column:start_time"` EndTime time.Time `gorm:"column:end_time"` } // Order 订单模型,对应 orders_list 表 type Order struct { OrderId string `gorm:"column:order_id"` // 关联商品ID TradeTime time.Time `gorm:"column:trade_time"` } // 为模型指定数据库表名 func (Goods) TableName() string { return "goods_list" } func (Order) TableName() string { return "oders_list" }