I'm passing an entities "id" as a string on a URL, for example:
..../foo/234565
I want to use the id in the following query:
//...i hace some code that gets stringId from the URL, and I verified that it works
stringId = ....
theKey, err := datastore.DecodeKey(stringId)
q := datastore.NewQuery("Foo").Filter("__key__ =", theKey)
The error I'm getting:
proto: can't skip unknown wire type 7 for datastore.Reference
Is there a simple way to convert stringId into a "Key"?
datastore.Get()
on a key. – dyoo Oct 27 '14 at 18:38datastore.DecodeKey()
only works on the values produced byKey.Encode()
. It appears from the content you've shown us so far that you've just plugged in a string value containing the entity name, a slash, and an ID with the hope that it would decode. But it shouldn't, according to the documentation:datastore.DecodeKey()
expects a specific serialization format that's exclusive toKey.Encode()
. – dyoo Oct 27 '14 at 18:53