You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Architecture with standard features: config, health check, logging, middleware log tracing
13
-

12
+
### Layer Architecture with full features
13
+

@@ -67,7 +67,7 @@ In this sample, search users with these criteria:
67
67
- GET: retrieve a representation of the resource
68
68
- POST: create a new resource
69
69
- PUT: update the resource
70
-
- PATCH: perform a partial update of a resource, refer to [service](https://github.com/core-go/service) and [sql](https://github.com/core-go/sql)
70
+
- PATCH: perform a partial update of a resource, refer to [core-go/core](https://github.com/core-go/core) and [core-go/sql](https://github.com/core-go/sql)
#### *Response:* 1: success, 0: not found, -1: error
224
176
```json
225
-
{
226
-
"status": 1,
227
-
"value": {
228
-
"email": "james.howlett@gmail.com",
229
-
"phone": "0987654321"
230
-
}
231
-
}
177
+
1
232
178
```
233
179
234
180
#### Problems for patch
@@ -241,19 +187,19 @@ type UserService interface {
241
187
```
242
188
We must solve 2 problems:
243
189
1. At http handler layer, we must convert the user struct to map, with json format, and make sure the nested data types are passed correctly.
244
-
2. At repository layer, from json format, we must convert the json format to database column name
190
+
2. At repository layer, from json format, we must convert the json format to database format (in this case, we must convert to column)
245
191
246
192
#### Solutions for patch
247
-
At http handler layer, we use [core-go/service](https://github.com/core-go/service), to convert the user struct to map, to make sure we just update the fields we need to update
193
+
At http handler layer, we use [core-go/core](https://github.com/core-go/core), to convert the user struct to map, to make sure we just update the fields we need to update
248
194
```go
249
-
importserver "github.com/core-go/service"
195
+
import"github.com/core-go/core"
250
196
251
197
func(h *UserHandler) Patch(whttp.ResponseWriter, r *http.Request) {
0 commit comments