douluo5937 2013-06-03 15:59
浏览 52
已采纳

在datastore.Query.Run(c).Next(x)上获取奇怪的错误

I have not run into this particular error before, and when I Google it I can't find anything at all out there that even mentions it. I am using Go language, performing a standard datastore query like I have many times before using an iterator, and I get this error: "proto: required fields not set in datastore.QueryResult". See my code below, any ideas?

k, err := datastore.NewQuery("QBConnection").
    Ancestor(datastore.NewKey(c, "Company", "", x.CompanyID, nil)).
    Limit(1).
    Run(c).
    Next(x)
if err != nil {
    if _, ok := err.(*datastore.ErrFieldMismatch); ok { err = nil } //ignore it if we can't load some fields
    if err == datastore.Done { err = nil } //If we don't find it in datastore, then just return nil
    if err != nil {return err}
}
  • 写回答

1条回答 默认 最新

  • dsfe167834 2013-06-03 16:41
    关注

    I figure it out for my case, at least. I'm still unsure exactly what the error message is supposed to mean, and I got a different error when I ran this in the live environment (which led to my answer). On the live site it told me "ancestor missing id/name"... long story short, my x.CompanyID variable was not set properly before running the query. Not sure why the error messages were so different on dev/live, and sure would have helped to get the missing id/name error on my dev server... but oh well, problem solved.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败