GAE Go数据存储区的大小
问题描述:
Is there some function one can call to get the amount of entries in the GAE Go Datastore of an app, without querying it for the whole database and counting the output?
是否可以调用某些函数来获取应用程序的GAE Go数据存储区中的条目数量,而无需查询 整个数据库并计算输出? p> div>
答
c := appengine.NewContext(r)
var result struct {
Bytes int64 `datastore:"bytes"`
Count int64 `datastore:"count"`
Timestamp datastore.Time `datastore:"timestamp"`
}
datastore.NewQuery("__Stat_Total__").Run(c).Next(&result)
c.Infof("count: %d", result.Count)