在DynamoDB Golang中删除不存在的身份
我正在有一个Golang项目,其中我使用dynamodb
作为我的后端数据库。当我们尝试删除不存在的实体时,我想返回错误。但是dynamodb.deleteitem
不会在该内容上返回错误。请帮助我。
I am having a golang project where I am using dynamoDB
as my backend database. I wanted to return the error when we are trying to Delete a non-existing entity. But the DynamoDB.DeleteItem
does not return an error on that thing. Please help me with that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
响应
实际上从deleteitem
方法中获得响应
。前任:
You can actually do it using the
response
you will get fromDeleteItem
method in dynamoDB.Ex:
实际上,第一个结构由 deleteItem函数是 deleteitemoutput
有一个评论,可以解决该对象的存在方式
您可以相应地调整逻辑,它可能会解决您的问题
Actually, the first struct returned by the DeleteItem function is a DeleteItemOutput
There's a comment that addresses how this object would be present
You can adjust your logic accordingly and it might solve your problem