I am trying to work with entities WITHOUT predefining the structs, and
instead of using a map (which is now deprecated) I am using
datastore.PropertyList (and datastore.Property items inside).
Despite successfully saving items (and being able to load them one at
a time if I know the key), I am unable to use Query.GetAll() to load a
set of them.
For example:
---
// save an entity
var plist datastore.PropertyList = make(datastore.PropertyList, 3)
plist = append(plist, datastore.Property { "name", "Mat", false,
false })
plist = append(plist, datastore.Property { "age", "29", false,
false })
plist = append(plist, datastore.Property { "location", "London",
false, false })
key := datastore.NewIncompleteKey(context, "Record", nil)
datastore.Put(context, key, &plist)
// load them all
query := datastore.NewQuery("Record")
plists := make(datastore.PropertyList, 0, 10)
keys, err := query.GetAll(context, &plists)
---
I get the following error: "datastore: cannot load field "age" into a
"datastore.Property": no such struct field"
It seems that it doesn't complain about `Name` because that happens to
be a valid property of datastore.Property, so how do I get it to load
the items as intended, with each item in `plists` itself being a
datastore.PropertyList instead of datastore.Property?
I asked this question at SO too:
http://stackoverflow.com/questions/8931134/putting-many-propertylists-into-google-app-engine-datastore-in-go-and-loading