go - reflect.Value.Set using unaddressable value -
g.get("/", func(c echo.context) error { var users []models.user err := db.find(users).error if err != nil { fmt.println(err) } return c.json(http.statusok, users) })
this code getting , displaying users table using slice resulting following error gorm
reflect.value.set using unaddressable value
any appreciated
you have call find pointer slice.
err := db.find(&users).error
relevant gorm documentation: http://jinzhu.me/gorm/crud.html#query
wiki
Comments
Post a Comment