We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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]) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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])
}
The text was updated successfully, but these errors were encountered: