I am using aws-sdk-go library for DynamoDb connectivity in Golang.
My DynamoDb table have a Partition key DeviceId (String) and a Sort Key Time (Number). How can I write GetItemInput to get all data with a specific DeviceId?
params := &dynamodb.GetItemInput{
Key: map[string]*dynamodb.AttributeValue {
"DeviceId": {
S: aws.String("item_1"),
},
},
ExpressionAttributeNames: map[string]*string{
"DeviceId": "DeviceId",
},
TableName: aws.String("DbName"),
}
list, err := svc.GetItem(params)
You have to use Query or Scan operation, this is a simple example but you can read more on Amazon documentation here
In particular, Query operation