本文整理汇总了Golang中github.com/vburenin/firempq/pqueue.PQueue.DeleteByReceipt方法的典型用法代码示例。如果您正苦于以下问题:Golang PQueue.DeleteByReceipt方法的具体用法?Golang PQueue.DeleteByReceipt怎么用?Golang PQueue.DeleteByReceipt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/vburenin/firempq/pqueue.PQueue
的用法示例。
在下文中一共展示了PQueue.DeleteByReceipt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DeleteMessageBatch
func DeleteMessageBatch(pq *pqueue.PQueue, sqsQuery *urlutils.SQSQuery) sqs_response.SQSResponse {
attrs, _ := urlutils.ParseNNotationAttr(
"DeleteMessageBatchRequestEntry.", sqsQuery.ParamsList, nil, NewDeleteBatchParams)
attrsLen := len(attrs)
checker, err := validation.NewBatchIdValidation(attrsLen)
if err != nil {
return err
}
attrList := make([]*DeleteBatchParams, 0, attrsLen)
for i := 1; i <= attrsLen; i++ {
a, ok := attrs[i]
if !ok {
return sqserr.MissingParameterError("The request is missing sequence %d", i)
}
p, _ := a.(*DeleteBatchParams)
if err = checker.Validate(p.Id); err != nil {
return err
}
attrList = append(attrList, p)
}
output := &DeleteMessageBatchResponse{
RequestId: "delbatch",
}
for _, batchItem := range attrList {
resp := pq.DeleteByReceipt(batchItem.ReceiptHandle)
if resp == mpqerr.ERR_INVALID_RECEIPT {
e := sqserr.InvalidReceiptHandleError("The input receipt handle is not a valid receipt handle.")
output.ErrorEntry = append(output.ErrorEntry, e.BatchResult(batchItem.Id))
} else {
output.ResultEntry = append(output.ResultEntry, &OkDelete{Id: batchItem.Id})
}
}
return output
}
示例2: DeleteMessage
func DeleteMessage(pq *pqueue.PQueue, sqsQuery *urlutils.SQSQuery) sqs_response.SQSResponse {
var receipt string
paramsLen := len(sqsQuery.ParamsList) - 1
for i := 0; i < paramsLen; i += 2 {
if sqsQuery.ParamsList[i] == "ReceiptHandle" {
receipt = sqsQuery.ParamsList[i+1]
}
}
if receipt == "" {
return sqserr.MissingParameterError("The request must contain the parameter ReceiptHandle.")
}
resp := pq.DeleteByReceipt(receipt)
if resp == mpqerr.ERR_INVALID_RECEIPT {
return sqserr.InvalidReceiptHandleError("The input receipt handle is not a valid receipt handle.")
}
return &DeleteMessageResponse{
RequestId: "delreq",
}
}