package gorm_models import "time" type Product struct { ID uint `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time Sku string Type string ParentID uint `sql:"DEFAULT:NULL"` AttributeFamilyID uint AttributeFamily AttributeFamily BrandID uint `sql:"DEFAULT:NULL"` Brand Brand Images []ProductImage Categories []Category `gorm:"many2many:product_categories;"` AttributeValues []ProductAttributeValue } // $main_attributes = [ // // 'sku' => $parentProduct->sku, // 'product_number' => $data['product_number'], // 'name' => $data['name'], // 'weight' => $data['weight'] ?? 0.45, // 'source' => $data['url_key'], // 'status' => 1, // 'visible_individually' => 1, // 'url_key' => $parentProduct->sku, // 'short_description' => $desc, // 'description' => $desc, // 'favoritesCount' => $data['favorite_count'] // // ]; type ProductFlat struct { ID uint `gorm:"primary_key"` Sku string ProductNumber string Name string Weight float64 `gorm:"type:decimal(12,4)"` Status bool Source string VisibleIndividually bool UrlKey string ShortDescription string Description string FavoritesCount uint CreatedAt time.Time UpdatedAt time.Time Product Product } type ProductImage struct { ID uint `gorm:"primary_key"` Type string Path string ProductID uint } type ProductAttributeValue struct { ID uint `gorm:"primary_key"` Locale string Channel string ProductID uint AttributeID uint TextValue string BooleanValue bool IntegerValue int FloatValue float64 `gorm:"type:decimal(12,4)"` } type ProductSuperAttribute struct { ProductID uint AttributeID uint }