App Engine Go中的无情查询 [英] Kindless Queries in App Engine Go

查看:116
本文介绍了App Engine Go中的无情查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python中,它是

  q = db.Query()
q.ancestor(ancestor_key)

我试过了:

  q.Ancestor(ancestor_key)



<



我也试过: p> q:=& datastore.Query {}
q.Ancestor(ancestor_key)

我得到错误datastore:空查询类型

感谢您提供任何有关此事的帮助。

解决方案

Rich Churcher的评论似乎是正确的,至少在这个时候是这样。


我认为Go中不支持Python无用的祖先查询。
一段时间以来,我认为你可以使用祖先密钥的Kind()
方法,然后我喝了一些咖啡,然后来到我的感觉。



In Python it's

q = db.Query()
q.ancestor(ancestor_key)

I tried:

q := datastore.NewQuery("")
q.Ancestor(ancestor_key)

I get the error "datastore: empty kind" when running GetAll

I also tried:

q := &datastore.Query{}
q.Ancestor(ancestor_key)

I get the error "datastore: empty query kind"

Thanks in advance for any help with this matter.

解决方案

Rich Churcher's comment seems to be right, at least at this point in time.

I don't think the Python kindless ancestor query is supported in Go. For a moment there I thought you could use the ancestor key's Kind() method, then I had some more coffee and came to my senses.

这篇关于App Engine Go中的无情查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆