Initial commit: 商品售卖网站
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Cart struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
UserID uint `gorm:"index;not null" json:"user_id"`
|
||||
ProductID uint `gorm:"index;not null" json:"product_id"`
|
||||
Quantity int `gorm:"not null" json:"quantity"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Product Product `json:"product,omitempty"`
|
||||
}
|
||||
|
||||
func (Cart) TableName() string {
|
||||
return "carts"
|
||||
}
|
||||
Reference in New Issue
Block a user