Getting Started with DynamoDB in Go (Part 3— Create, Read, Update and Delete an Item)

ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
“:r”: {
N: aws.String(“0.5”),
},
},
{
year: 2015,
title: “The Big New Movie”,
info: {
plot: “Nothing happens at all.”,
rating: 0
}
}
go run main.go
We have inserted a new item!
go run main.go
year: 2015
title: The Big New Movie
rating : 0
plot : Nothing happens at all.
{
year: 2015,
title: “The Big New Movie”,
info: {
plot: “Everything happens all at once.”,
rating: 5.5,
actors: [“Larry”, “Moe”, “Curly”]
}
}
Updated plot: Everything happens all at once.
Updated rating: 5.5
Updated actors: [Larry Moe Curly]
Updated rating: 6.5
ConditionalCheckFailedException: The conditional request failed
status code: 400, request id: 3d6f2674–7de9–4a8c-ae6e-dfb98b49b691
Actors updated: [Moe Curly]
ConditionalCheckFailedException: The conditional request failed
status code: 400, request id: 07d86ea1–5d42–4016–9b7e-47a4b1fa0f82
The item has been deleted

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store