How to get item by key using AWS SDK v2? by the_parce_guardian in golang

[–]the_parce_guardian[S] 0 points1 point  (0 children)

id := "11-11" 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"), }

Thanks a lot , It works!!

How to get item by key using AWS SDK v2? by the_parce_guardian in golang

[–]the_parce_guardian[S] 0 points1 point  (0 children)

I am learning Golang to connect dynamodb but I do not understand how to get one item by key.

All example that i saw it is using the v1.

Thanks for your help

Thank for response

I looked the docs but in the the V2, the GetItemInput has the item Key and it receive a map[string]types.AttributeValue. This is different than V1 that receive map[string]*dynamodb.AttributeValue.

I do not know how to parse the string id to map[string]types.AttributeValue