Easy as usual!
func deleteEntries(mealsID []string, r *http.Request) int{ // Get context from c := appengine.NewContext(r); for _,id := range mealsID{ ID,_ := strconv.Atoi(id) // Build query to receive the values q:= datastore.NewQuery("Meal").Ancestor(mealStoreKey(c)).Filter("Id =", ID ).KeysOnly() // Receive all keys and delete them. keys, err := q.GetAll(c, nil) if err != nil{ return 0 } log.Printf("ID: %v ", id) log.Printf("Keys: %v ", keys) e := datastore.DeleteMulti(c, keys) if e != nil{ log.Printf("%v ", e) return 33 } } return len(mealsID) }
I think, the next post will be longer!.
P.S. Checkout my repository on Bitbucket for the latest code! https://bitbucket.org/loose11/mycanteen
No comments:
Post a Comment