MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / DeleteByID

Method DeleteByID

internal/handler/userExample.go:95–111  ·  view source on GitHub ↗

DeleteByID delete a userExample by id @Summary Delete a userExample by id @Description Deletes a existing userExample identified by the given id in the path. @Tags userExample @Accept json @Produce json @Param id path string true "id" @Success 200 {object} types.DeleteUserExampleByIDReply{} @Router

(c *gin.Context)

Source from the content-addressed store, hash-verified

93// @Router /api/v1/userExample/{id} [delete]
94// @Security BearerAuth
95func (h *userExampleHandler) DeleteByID(c *gin.Context) {
96 _, id, isAbort := getUserExampleIDFromPath(c)
97 if isAbort {
98 response.Error(c, ecode.InvalidParams)
99 return
100 }
101
102 ctx := middleware.WrapCtx(c)
103 err := h.iDao.DeleteByID(ctx, id)
104 if err != nil {
105 logger.Error("DeleteByID error", logger.Err(err), logger.Any("id", id), middleware.GCtxRequestIDField(c))
106 response.Output(c, ecode.InternalServerError.ToHTTPCode())
107 return
108 }
109
110 response.Success(c)
111}
112
113// UpdateByID update a userExample by id
114// @Summary Update a userExample by id

Callers

nothing calls this directly

Calls 11

ErrorFunction · 0.92
WrapCtxFunction · 0.92
ErrorFunction · 0.92
ErrFunction · 0.92
AnyFunction · 0.92
GCtxRequestIDFieldFunction · 0.92
OutputFunction · 0.92
SuccessFunction · 0.92
getUserExampleIDFromPathFunction · 0.85
ToHTTPCodeMethod · 0.80
DeleteByIDMethod · 0.65

Tested by

no test coverage detected