我最近在发出一个简单的 datastore.GetAll() 请求时遇到一个我以前从未见过的错误。我无法弄清楚这意味着什么,我找不到任何包含错误消息的文档或从谷歌搜索错误消息的任何帮助。
这是我的代码:
type MyUnderlyingStruct struct {
ApplyTo *datastore.Key
ApplyFrom *datastore.Key
Amount float64
LocationKey *datastore.Key
DepartmentKey *datastore.Key
SubjectAreaKey *datastore.Key
}
type MyStruct []MyUnderlyingStruct
//In the case where I get the error someKey is a valid, complete Key value
// of a different kind that what we are querying for and there is actually
// an entity in my datastore that matches this query
func (x *MyStruct) Load(w http.ResponseWriter, r *http.Request, someKey *datastore.Key) (error) {
c := appengine.NewContext(r)
q := datastore.NewQuery("MyUnderlyingStruct_KindName").Order("-Amount")
if someKey != nil { q = q.Filter("ApplyTo=", someKey) }
keys, err := q.GetAll(c,x)
if _, ok := err.(*datastore.ErrFieldMismatch); ok { err = nil }
if err != nil && err != datastore.Done {return err}
return nil
}
返回此错误:
API error 1 (datastore_v3: BAD_REQUEST): The kind is the empty string.
谁能告诉我为什么我会收到这个错误,或者它想告诉我什么?
aluckdog
相关分类