File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -133,34 +133,34 @@ var (
133
133
// Handlers
134
134
// ----------
135
135
136
- func createUser (c *echo .Context ) * echo . HTTPError {
136
+ func createUser (c *echo .Context ) error {
137
137
u := &user{
138
138
ID: seq,
139
139
}
140
- if he := c.Bind (u); he != nil {
141
- return he
140
+ if err := c.Bind (u); err != nil {
141
+ return err
142
142
}
143
143
users[u.ID ] = u
144
144
seq++
145
145
return c.JSON (http.StatusCreated , u)
146
146
}
147
147
148
- func getUser (c *echo .Context ) * echo . HTTPError {
148
+ func getUser (c *echo .Context ) error {
149
149
id , _ := strconv.Atoi (c.Param (" id" ))
150
150
return c.JSON (http.StatusOK , users[id])
151
151
}
152
152
153
- func updateUser (c *echo .Context ) * echo . HTTPError {
153
+ func updateUser (c *echo .Context ) error {
154
154
u := new (user)
155
- if he := c.Bind (u); he != nil {
156
- return he
155
+ if err := c.Bind (u); err != nil {
156
+ return err
157
157
}
158
158
id , _ := strconv.Atoi (c.Param (" id" ))
159
159
users[id].Name = u.Name
160
160
return c.JSON (http.StatusOK , users[id])
161
161
}
162
162
163
- func deleteUser (c *echo .Context ) * echo . HTTPError {
163
+ func deleteUser (c *echo .Context ) error {
164
164
id , _ := strconv.Atoi (c.Param (" id" ))
165
165
delete (users, id)
166
166
return c.NoContent (http.StatusNoContent )
Original file line number Diff line number Diff line change @@ -24,34 +24,34 @@ var (
24
24
// Handlers
25
25
//----------
26
26
27
- func createUser (c * echo.Context ) * echo. HTTPError {
27
+ func createUser (c * echo.Context ) error {
28
28
u := & user {
29
29
ID : seq ,
30
30
}
31
- if he := c .Bind (u ); he != nil {
32
- return he
31
+ if err := c .Bind (u ); err != nil {
32
+ return err
33
33
}
34
34
users [u .ID ] = u
35
35
seq ++
36
36
return c .JSON (http .StatusCreated , u )
37
37
}
38
38
39
- func getUser (c * echo.Context ) * echo. HTTPError {
39
+ func getUser (c * echo.Context ) error {
40
40
id , _ := strconv .Atoi (c .Param ("id" ))
41
41
return c .JSON (http .StatusOK , users [id ])
42
42
}
43
43
44
- func updateUser (c * echo.Context ) * echo. HTTPError {
44
+ func updateUser (c * echo.Context ) error {
45
45
u := new (user )
46
- if he := c .Bind (u ); he != nil {
47
- return he
46
+ if err := c .Bind (u ); err != nil {
47
+ return err
48
48
}
49
49
id , _ := strconv .Atoi (c .Param ("id" ))
50
50
users [id ].Name = u .Name
51
51
return c .JSON (http .StatusOK , users [id ])
52
52
}
53
53
54
- func deleteUser (c * echo.Context ) * echo. HTTPError {
54
+ func deleteUser (c * echo.Context ) error {
55
55
id , _ := strconv .Atoi (c .Param ("id" ))
56
56
delete (users , id )
57
57
return c .NoContent (http .StatusNoContent )
You can’t perform that action at this time.
0 commit comments