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

Method DeleteByID

internal/service/userExample.go:75–90  ·  view source on GitHub ↗

DeleteByID delete a userExample by id

(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest)

Source from the content-addressed store, hash-verified

73
74// DeleteByID delete a userExample by id
75func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
76 err := req.Validate()
77 if err != nil {
78 logger.Warn("req.Validate error", logger.Err(err), logger.Any("req", req), interceptor.ServerCtxRequestIDField(ctx))
79 return nil, ecode.StatusInvalidParams.Err()
80 }
81 ctx = interceptor.WrapServerCtx(ctx)
82
83 err = s.iDao.DeleteByID(ctx, req.Id)
84 if err != nil {
85 logger.Error("DeleteByID error", logger.Err(err), logger.Any("id", req.Id), interceptor.ServerCtxRequestIDField(ctx))
86 return nil, ecode.StatusInternalServerError.ToRPCErr()
87 }
88
89 return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
90}
91
92// UpdateByID update a userExample by id
93func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {

Callers

nothing calls this directly

Calls 10

WarnFunction · 0.92
ErrFunction · 0.92
AnyFunction · 0.92
ServerCtxRequestIDFieldFunction · 0.92
WrapServerCtxFunction · 0.92
ErrorFunction · 0.92
ToRPCErrMethod · 0.80
ValidateMethod · 0.65
DeleteByIDMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected