/
Order.go
36 lines (30 loc) · 824 Bytes
/
Order.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package models
import (
"time"
"gorm.io/gorm"
)
type OrderBase struct {
OrderDate time.Time `gorm:"not null"`
RequiredDate time.Time `gorm:"not null"`
ShippedDate time.Time `gorm:"not null"`
ShipName string `gorm:"not null"`
ShipAddress string `gorm:"not null"`
ShipCity string `gorm:"not null"`
ShipPostalCode string `gorm:"not null"`
ShipCountry string `gorm:"not null"`
CustomerID string `gorm:"not null; unique_index"`
ShipperID string `gorm:"not null; unique_index"`
}
type Order struct {
gorm.Model
ID string `gorm:"primaryKey; not null; unique_index"`
OrderBase
Payments []Payment
}
type OrderCreate struct {
OrderBase
}
// TableName overrides the table name used by Order to `order`
func (Order) TableName() string {
return "order"
}