Cannot range over pointer to slice in Go?

What am I doing wrong?

Here is the struct:
package repositories import ( "mobifit/app/domain/entities" ) type ClassRepository struct { *Repository } func (c *ClassRepository) ClassesForLastNDays(days int) *[]entities.Class { classes := new([]entities.Class) query := Select("*"). From("Class"). Where("VisibleAt > CURRENT_TIMESTAMP() - INTERVAL ? DAY"). OrderBy("ClassTypeId"). Sql() c.Repository.Select(classes, query, days) c.populateClassRelationships(classes) return classes } func (c *ClassRepository) populateClassRelationships(classes *[]entities.Class) { for i := range classes { <<<<<<<<<<< Here is the problem class := classes[i] // ClassType c.Repository.GetById(class.ClassType, class.ClassTypeId) //Instructor c.Repository.GetById(class.Instructor, class.ClassType.InstructorId) // Equipment query := Select("E.*"). From("Equipment E"). Join("ClassEquipment CE on E.Id = CE.EquipmentId"). Where("CE.ClassId = ?"). Sql() c.Repository.Select(class.Equipment, query, class.Id) } }

Here is the Class struct:
package entities import ( "time" ) type Class struct { Id int ClassTypeId int VideoPath string VideoSize int Duration float64 CreatedAt time.Time VisibleAt time.Time NoLongerVisibleAt time.Time // Relationships ClassType ClassType Instructor User Equipment []Equipment }

Write your answer...

Never miss a post from Chris Gregori, when you sign up for Ednsquare.