package model import "time" type CustomerOrder struct { OrderID uint `gorm:"column:order_id;primaryKey;autoIncrement" json:"order_id"` UserID uint `gorm:"column:user_id;not null;index" json:"user_id"` Name string `gorm:"column:name;not null" json:"name"` CountryID uint `gorm:"column:country_id;not null" json:"country_id"` AddressString string `gorm:"column:address_string;not null" json:"address_string"` AddressUnparsed *AddressUnparsed `gorm:"-" json:"address_unparsed"` Status string `gorm:"column:status;size:50;not null" json:"status"` BasePrice float64 `gorm:"column:base_price;type:decimal(10,2);not null" json:"base_price"` TaxIncl float64 `gorm:"column:tax_incl;type:decimal(10,2);not null" json:"tax_incl"` TaxExcl float64 `gorm:"column:tax_excl;type:decimal(10,2);not null" json:"tax_excl"` CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"` Products []OrderProduct `gorm:"foreignKey:OrderID;references:OrderID" json:"products"` } func (CustomerOrder) TableName() string { return "b2b_customer_orders" } type OrderProduct struct { OrderID uint `gorm:"column:order_id;not null;index" json:"-"` ProductID uint `gorm:"column:product_id;not null" json:"product_id"` ProductAttributeID *uint `gorm:"column:product_attribute_id" json:"product_attribute_id,omitempty"` Amount uint `gorm:"column:amount;not null" json:"amount"` } func (OrderProduct) TableName() string { return "b2b_orders_products" }