有沒有辦法ids []int64對數(shù)據(jù)存儲進(jìn)行查詢?我嘗試了以下無濟(jì)于事。錯誤輸出q := datastore.NewQuery("Category").Filter("Id IN", ids)只為我獲取數(shù)據(jù)存儲中的所有類別for _, id := range ids { q.Filter("Id =", id)}在icza的回答之后var keys []*datastore.Keyfor _, id := range ids { keys = append(keys, datastore.NewKey(c, "Category", "", id, nil))}categories := make([]Category, len(keys))err := datastore.GetMulti(c, keys, categories)if err != nil { return nil, err}
- 1 回答
- 0 關(guān)注
- 196 瀏覽
添加回答
舉報
0/150
提交
取消