Ale*_*oya 6 go amazon-dynamodb aws-sdk-go
我正在学习 Golang 使用 AWS-SDK-GO-V2 连接 dynamodb 但我不明白如何通过密钥获取一项。
我看到的所有示例都使用 v1,但我需要 V2。
Ale*_*oya 12
我在reddit上找到了解决方案
例子
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"),
}
Run Code Online (Sandbox Code Playgroud)
GoP*_*Pro -6
AWS SDK Go V2 开发人员指南是一个很好的起点。
建议查看https://aws.github.io/aws-sdk-go-v2/docs/getting-started/