6

I am learning Golang to connect dynamodb using AWS-SDK-GO-V2 but I do not understand how to get one item by key.

All example that i saw it is using the v1 but I NEED WITH V2.

Alex Montoya
  • 4,697
  • 1
  • 30
  • 31

2 Answers2

10

I found the solution in reddit

Example

getItemInput := &dynamodb.GetItemInput{
  Key: map[string]types.AttributeValue{
    "Id": &types.AttributeValueMemberS{Value: id},
  },
  TableName:            aws.String("TableName"),
  ConsistentRead:       aws.Bool(true),
  ProjectionExpression: aws.String("Id, Name, Timestamp"),
}
Alex Montoya
  • 4,697
  • 1
  • 30
  • 31
-6

AWS SDK Go V2 Developer guide is a good place to start.

Recommend taking a look at https://aws.github.io/aws-sdk-go-v2/docs/getting-started/

GoPro
  • 642
  • 1
  • 10
  • 24