How to get item by key in dynamodb using AWS SDK v2?
Asked Answered
F

2

7

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.

Fructify answered 19/4, 2021 at 1:30 Comment(0)
F
13

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"),
}
Fructify answered 29/4, 2021 at 5:50 Comment(0)
I
-7

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/

Illgotten answered 23/4, 2021 at 21:13 Comment(1)
The link provided links to generic skk v2 docs. Those docs do not contain any specific detail about how to resolve the OPs question.Cataldo

© 2022 - 2024 — McMap. All rights reserved.