英文:
How do I get Dynamodb Item count from item summary NOT scan
问题
我正在尝试从我的DynamoDB表中返回项目计数。我已经有一个名为getLiveItemCount()的函数,大致如下:
func GetLiveItemCount(tableName string) *int64 {
dynamodbClient := createDynamoDBClient()
items, _ := dynamodbClient.Scan(&dynamodb.ScanInput{
TableName: aws.String(tableName),
})
return items.Count
}
然而,我希望有另一个函数,可以从最近更新的项目指标中返回项目计数,就像item summary使用的那样(项目摘要包括项目计数、表大小和平均项目大小,每6小时更新一次)。有没有办法在Golang中获取这个值?
英文:
I'm trying to return the item count from my dynamodb table. I already have a getLiveItemCount() function which looks something like this:
func GetLiveItemCount(tableName string) *int64 {
dynamodbClient := createDynamoDBClient()
items, _ := dynamodbClient.Scan(&dynamodb.ScanInput{
TableName: aws.String(tableName),
})
return items.Count
}
However, I'm looking to have another function that returns the item count from the most recently updated item metrics that item summary uses (items summary includes item count, table size, and Average item size which are updated every 6 hours). Is there any way to get this value in Golang?
答案1
得分: 1
要获取这些值,您可以调用DescribeTable函数:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html
英文:
To get those values you call DescribeTable:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论