【发布时间】:2012-07-25 20:37:26
【问题描述】:
这个问题已经被 Python 回答了: How to get all records from GAE datastore with particular parent?
如何在 Go 中执行此操作?我想做类似的事情:
t := new(TagRecord)
k, err := datastore.DecodeKey(r.URL.Path[1:])
...
_, err = datastore.NewQuery("TagRecord").
Filter("Parent =", k).
Order("-CreatedAt").
Limit(1).
Run(c).Next(t)
...但这会失败并出现以下错误:
datastore: query has no more results
当我尝试按其他属性进行过滤时,包括那些硬编码到过滤器中的属性和通过 URL 传递的属性,查询会正常运行并使用正确的属性填充 t。我的问题能以多么令人羞耻的简单来解决?
【问题讨论】:
标签: google-app-engine google-cloud-datastore go