I need to run an equivalent of this, but in a transaction:
db.GetAll(ctx, datastore.NewQuery("Items").Ancestor(pkey), &itemContainers)
But the Transaction{}
type does not seem to have a GetAll()
method. How can I get this done?
To use queries in transactions you should attach your transaction to the query. E.g.
q = datastore.NewQuery("Items").Ancestor(pkey).Transaction(tx)
db.Getall(ctx, q, &itemContainers)