(c *gin.Context, set func(int))
| 435 | } |
| 436 | |
| 437 | func (h *Handler) updateIntField(c *gin.Context, set func(int)) { |
| 438 | var body struct { |
| 439 | Value *int `json:"value"` |
| 440 | } |
| 441 | if err := c.ShouldBindJSON(&body); err != nil || body.Value == nil { |
| 442 | c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body"}) |
| 443 | return |
| 444 | } |
| 445 | set(*body.Value) |
| 446 | h.persist(c) |
| 447 | } |
| 448 | |
| 449 | func (h *Handler) updateStringField(c *gin.Context, set func(string)) { |
| 450 | var body struct { |
no test coverage detected