Google App Engine - ByteString 查询失败

Google App Engine - ByteString query fails

我正在开发一个 Go 应用程序,其中我有一个带有 属性 的实体,它包含一个标识令牌,它是一个随机字节串。我将此 属性 存储为 ByteString,并且在我的开发环境中,我已经能够使用以下形式的过滤器查询此 属性:

// token is a []byte
idTok := datastore.ByteString(token)
q := ds.NewQuery("Entity").Filter("IDToken =", idTok)

var entities []Entity
keys, err := q.GetAll(c, &entities)

但不幸的是,当作为模块部署到 GAE 时,此查询 returns 错误:datastore: bad query filter value type: unsupported datastore value type: datastore.ByteString,这令人困惑,因为我认为 ByteString 类型的目的是能够索引500 字节以下的二进制数据量较少。

我首先根据这个 SO 问题的第二个答案切换到使用 ByteString 类型:Golang - Appengine datastore filter query with []byte comparison

这个问题大约一周后自行解决。由于它只出现在模块环境中,我猜测他们的某些代码尚未更新以支持 ByteString 类型,而现在是。现在效果很好!