List lists a set of records from the database. Method: GET.
(ctx iris.Context)
| 53 | // List lists a set of records from the database. |
| 54 | // Method: GET. |
| 55 | func (h *ProductHandler) List(ctx iris.Context) { |
| 56 | key := ctx.Request().URL.RawQuery |
| 57 | |
| 58 | products := []byte("[]") |
| 59 | err := h.cache.List(ctx.Request().Context(), key, &products) |
| 60 | if err != nil && err != sql.ErrNoRows { |
| 61 | debugf("ProductHandler.List(DB) (%s): %v", |
| 62 | key, err) |
| 63 | |
| 64 | writeInternalServerError(ctx) |
| 65 | return |
| 66 | } |
| 67 | |
| 68 | ctx.ContentType("application/json") |
| 69 | ctx.Write(products) |
| 70 | } |
| 71 | |
| 72 | // Create adds a record to the database. |
| 73 | // Method: POST. |
nothing calls this directly
no test coverage detected