我正在開發一個 Go 應用程序,其中我有一個帶有屬性的實體,該屬性包含一個隨機字節串的標識令牌。我將此屬性存儲為 ByteString,并且在我的開發環境中,我已經能夠使用以下形式的過濾器查詢此屬性:// token is a []byteidTok := datastore.ByteString(token)q := ds.NewQuery("Entity").Filter("IDToken =", idTok)var entities []Entitykeys, err := q.GetAll(c, &entities)但不幸的是,當作為模塊部署到 GAE 時,此查詢返回錯誤:datastore: bad query filter value type: unsupported datastore value type: datastore.ByteString,這令人困惑,因為我認為 ByteString 類型的目的是能夠索引 500 字節以下的更短數量的二進制數據。我首先根據這個 SO 問題的第二個答案切換到使用 ByteString 類型:Golang - Appengine datastore filter query with []byte compare
- 1 回答
- 0 關注
- 211 瀏覽
添加回答
舉報
0/150
提交
取消