MCPcopy
hub / github.com/nats-io/nats.go / deleteMsg

Method deleteMsg

jsm.go:1436–1458  ·  view source on GitHub ↗
(ctx context.Context, stream string, req *msgDeleteRequest)

Source from the content-addressed store, hash-verified

1434}
1435
1436func (js *js) deleteMsg(ctx context.Context, stream string, req *msgDeleteRequest) error {
1437 if err := checkStreamName(stream); err != nil {
1438 return err
1439 }
1440 reqJSON, err := json.Marshal(req)
1441 if err != nil {
1442 return err
1443 }
1444
1445 dsSubj := js.apiSubj(fmt.Sprintf(apiMsgDeleteT, stream))
1446 r, err := js.apiRequestWithContext(ctx, dsSubj, reqJSON)
1447 if err != nil {
1448 return err
1449 }
1450 var resp msgDeleteResponse
1451 if err := json.Unmarshal(r.Data, &resp); err != nil {
1452 return err
1453 }
1454 if resp.Error != nil {
1455 return resp.Error
1456 }
1457 return nil
1458}
1459
1460// StreamPurgeRequest is optional request information to the purge API.
1461type StreamPurgeRequest struct {

Callers 2

DeleteMsgMethod · 0.95
SecureDeleteMsgMethod · 0.95

Calls 3

apiSubjMethod · 0.95
apiRequestWithContextMethod · 0.95
checkStreamNameFunction · 0.85

Tested by

no test coverage detected