I have a psql Database, and I am using the gorm library as well as the pq driver, as you see there is a many to many relationship for related products, however this throws out the error pq: column "product_id" specified more than once
is there a way to set an alias or am I going about this the wrong way?
type Product struct {
Id int64 `json:"_id"`
Price float32 `json:"price"`
Name string `sql:"size:255" json:"name"`
Description string `json:"description"`
Material string `json:"material"`
Color string `json:"color"`
ColorId int64 `json:"colorId"`
Categories []Category `gorm:"many2many:product_categories;" json:"categories"`
Images []Image `json:"images"`
Tags []Tag `gorm:"many2many:product_tags;" json:"tags"`
Main bool `json:"main"`
Available bool `json:"available"`
Slug string `json:"slug"`
CreatedAt time.Time `json:"createdAt"`
Related []Product `gorm:"many2many:related_products;" json:"related"`
}