如何从项目摘要不扫描中获取 Dynamodb 项目计数

我正在尝试从我的 dynamodb 表中返回项目计数。我已经有一个 getLiveItemCount() 函数,它看起来像这样:


func GetLiveItemCount(tableName string) *int64 {

    dynamodbClient := createDynamoDBClient()


    items, _ := dynamodbClient.Scan(&dynamodb.ScanInput{

        TableName: aws.String(tableName),

    })


    return items.Count

}

但是,我希望有另一个函数可以从项目摘要使用的最近更新的项目指标中返回项目计数(项目摘要包括item count、table size和Average item size每 6 小时更新一次)。有什么办法可以在 Golang 中获取这个值吗?


蓝山帝景
浏览 71回答 1
1回答

GCT1015

要获取这些值,您可以调用 DescribeTable:https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go