MCPcopy Create free account
hub / github.com/kataras/iris / List

Method List

_examples/database/mysql/api/product_handler.go:55–70  ·  view source on GitHub ↗

List lists a set of records from the database. Method: GET.

(ctx iris.Context)

Source from the content-addressed store, hash-verified

53// List lists a set of records from the database.
54// Method: GET.
55func (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.

Callers

nothing calls this directly

Calls 7

debugfFunction · 0.85
writeInternalServerErrorFunction · 0.85
RequestMethod · 0.80
ContextMethod · 0.80
ListMethod · 0.65
ContentTypeMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected