Last active
July 16, 2024 01:26
-
-
Save BK1031/673fd80490f34df15d41b6a1cfd397eb to your computer and use it in GitHub Desktop.
singlestore-go-bookstore order structs
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 "time" | |
type Order struct { | |
ID int `json:"id" gorm:"primaryKey,autoIncrement"` | |
Total float64 `json:"total"` | |
Items []OrderItem `json:"items" gorm:"-"` | |
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime,precision:6"` | |
} | |
type OrderItem struct { | |
OrderID int `json:"order_id" gorm:"primaryKey"` | |
BookID int `json:"book_id" gorm:"primaryKey"` | |
Book Book `json:"book" gorm:"-"` | |
Quantity int `json:"quantity"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment