MCPcopy Create free account
hub / github.com/dhij/ecomm / listUsers

Method listUsers

ecomm-api/handler/handler.go:262–276  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

260}
261
262func (h *handler) listUsers(w http.ResponseWriter, r *http.Request) {
263 users, err := h.client.ListUsers(h.ctx, &pb.UserReq{})
264 if err != nil {
265 http.Error(w, "error listing users", http.StatusInternalServerError)
266 return
267 }
268
269 var res ListUserRes
270 for _, u := range users.GetUsers() {
271 res.Users = append(res.Users, toUserRes(u))
272 }
273
274 w.Header().Set("Content-Type", "application/json")
275 json.NewEncoder(w).Encode(res)
276}
277
278func (h *handler) updateUser(w http.ResponseWriter, r *http.Request) {
279 var u UserReq

Callers

nothing calls this directly

Calls 3

toUserResFunction · 0.85
GetUsersMethod · 0.80
ListUsersMethod · 0.65

Tested by

no test coverage detected