Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CartItemEntity ¶
type CartItemEntity struct {
ID uint64 `gorm:"primary_key" json:"id"`
TotalProduct int `gorm:"not null" json:"total_product"`
TotalPrice int `gorm:"not null" json:"total_price"`
UserID uint `gorm:"not null" json:"user_id"`
ProductID uint `gorm:"not null" json:"product_id"`
User UserEntity `gorm:"foreignkey:UserID" json:"user"`
Product ProductEntity `gorm:"foreignkey:ProductID" json:"product"`
}
type ProductEntity ¶
type ProductEntity struct {
gorm.Model
Name string `gorm:"type:varchar(80);not null" json:"name"`
Price int `gorm:"type:int;not null" json:"price"`
Description string `gorm:"type:text;not null" json:"description"`
Image string `gorm:"type:varchar(255);not null" json:"image"`
Stock int `gorm:"type:int;not null" json:"stock"`
UserID uint `gorm:"not null" json:"user_id"`
User UserEntity `gorm:"foreignkey:UserID" json:"user"`
}
type TransactionDetailEntity ¶
type TransactionDetailEntity struct {
gorm.Model
TransactionID uint `gorm:"not null" json:"transaction_id"`
ProductID uint `gorm:"not null" json:"product_id"`
Quantity int `gorm:"not null" json:"quantity"`
Price int `gorm:"not null" json:"price"`
Product ProductEntity `gorm:"foreignkey:ProductID" json:"product"`
Transaction TransactionEntity `gorm:"foreignkey:TransactionID" json:"transaction"`
}
type TransactionEntity ¶
type TransactionEntity struct {
gorm.Model
TotalPrice int `gorm:"type:int;not null" json:"total_price"`
UserID uint `gorm:"not null" json:"user_id"`
ItemDetail []TransactionDetailEntity `gorm:"foreignkey:TransactionID" json:"items"`
}
type UserEntity ¶
type UserEntity struct {
gorm.Model
Name string `gorm:"type:varchar(80);not null" json:"name"`
Email string `gorm:"type:varchar(60);not null;unique" json:"email"`
Password string `gorm:"type:varchar(255);not null" json:"password"`
PhoneNumber string `gorm:"type:varchar(20);not null;unique" json:"phone_number"`
Address string `gorm:"type:varchar(255);not null" json:"address"`
CartItems []CartItemEntity `gorm:"foreignkey:UserID" json:"cart_items"`
Transactions []TransactionEntity `gorm:"foreignkey:UserID" json:"transactions"`
}
Click to show internal directories.
Click to hide internal directories.