skip to Main Content

Postgresql – gorm preload loads duplicated values for many to many relation

i have a many to many relation like a customers and orders. type EmployeeShiftList struct { ID uint UUID uuid.UUID `gorm:"<-:create"` FirstName string `validate:"required,max=250"` LastName string `validate:"omitempty,max=250"` ShiftMaps []ShiftMap `gorm:"many2many:attendance.employee_shifts;foreignKey:ID;References:ShiftID;joinForeignKey:EmployeeID;joinReferences:ShiftID"} type ShiftMap struct { ShiftID uint `gorm:"primaryKey"` FromDate time.Time ToDate…

VIEW QUESTION
Back To Top
Search