Created
May 2, 2019 18:27
-
-
Save robzhu/c641c7ee2b304589469f3165e4f554c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function deleteFriendByValue(friendName: string) { | |
const Key = { id: "1234" }; | |
// Delete the value from the set. This operation is idempotent and will not | |
// produce an error if the value(s) are missing. | |
const { err, data } = await updateWithErrorWrapper({ | |
TableName, | |
Key, | |
UpdateExpression: `DELETE friends :valuesToRemove`, | |
ExpressionAttributeValues: { | |
":valuesToRemove": DynamoDB.createSet([friendName]) | |
} | |
}); | |
if (err) { | |
console.error("unhandled error: " + err); | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment