echox icon indicating copy to clipboard operation
echox copied to clipboard

Error On CRUD Cookbook

Open jung-jin-lee opened this issue 5 years ago • 0 comments

https://echo.labstack.com/cookbook/crud

I try to CRUD Cookbook. And I found two points to fix. (※1. line 19, 2. line 45) Can I fix it?

[AS-IS] var ( users = map[int]*user{} seq = 1 ) [TO-BE] var ( users = map[int]*User{} seq = 1 )

[AS-IS] func updateUser(c echo.Context) error { u := new(user) if err := c.Bind(u); err != nil { return err } id, _ := strconv.Atoi(c.Param("id")) users[id].Name = u.Name return c.JSON(http.StatusOK, users[id]) } [TO-BE] func updateUser(c echo.Context) error { u := new(User) if err := c.Bind(u); err != nil { return err } id, _ := strconv.Atoi(c.Param("id")) users[id].Name = u.Name return c.JSON(http.StatusOK, users[id]) }

jung-jin-lee avatar Feb 13 '20 13:02 jung-jin-lee