Last active
May 22, 2021 10:32
-
-
Save dipeshhkc/df01de41b1cc63db44214bc291ed86c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model | |
import ( | |
"github.com/jinzhu/gorm" | |
) | |
type Order struct { | |
gorm.Model | |
User User `gorm:"foreignkey:UserID"` | |
Product Product `gorm:"foreignkey:ProductID"` | |
UserID uint | |
ProductID uint | |
Quantity int `json:"quantity"` | |
} | |
func (Order) TableName() string { | |
return "orders" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment