当前位置: 首页>>代码示例>>Golang>>正文


Golang PQueue.DeleteByReceipt方法代码示例

本文整理汇总了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
}
开发者ID:vburenin,项目名称:firempq,代码行数:39,代码来源:delete_message_batch.go

示例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",
	}
}
开发者ID:vburenin,项目名称:firempq,代码行数:23,代码来源:delete_message.go


注:本文中的github.com/vburenin/firempq/pqueue.PQueue.DeleteByReceipt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。