g.GET(\"/\", func(c echo.Context) error {
var users []models.User
err := db.Find(users).Error
if err != nil {
fmt.Println(err)
}
return c.JSO
In a very similar fashion to the accepted answer (but in a slightly different context), and an error that I keep making in different projects:
func migrate(db *gorm.DB) {
db.AutoMigrate(User{}, Activity{})
}
becomes
func migrate(db *gorm.DB) {
db.AutoMigrate(&User{}, &Activity{})
}
Notice the ampersands.