提供可用于查找实体的密钥的 Web 安全表示
Provide web-safe representation of key that I can use to look up the entity
我想使用 Datastore Java API to retrieve an entity,但我在准备查找密钥时似乎遇到了问题。
这是密钥在 JSON 表示中的样子
partition_id {
dataset_id: "mydataset"
}
path_element {
kind: "MyKind"
id: 1234567890
}
但是,使用 DatastoreHelper.makeKey(Object...), with parameters MyKind
and the id 1234567890
only populates the path_element
part, and using such a key in a lookup request 从头开始创建密钥不会 return 产生任何结果。现在,我用数据集 ID 填充密钥,但感觉不对。
我通过 REST API 向客户端提供 ID,对于简单的加载,我不需要额外的信息,只需要种类和密钥。
有没有我还没见过的 API 使用 kind/id 组合轻松检索实体的方法?我不能使用 Objectify Keys to just load the entity using the id, because it seems Objectify does not work with protobuffers (via ).
Cloud Datastore API 当前未定义规范的 web-safe 键表示,但我们最终希望定义。
https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/88
我想使用 Datastore Java API to retrieve an entity,但我在准备查找密钥时似乎遇到了问题。
这是密钥在 JSON 表示中的样子
partition_id {
dataset_id: "mydataset"
}
path_element {
kind: "MyKind"
id: 1234567890
}
但是,使用 DatastoreHelper.makeKey(Object...), with parameters MyKind
and the id 1234567890
only populates the path_element
part, and using such a key in a lookup request 从头开始创建密钥不会 return 产生任何结果。现在,我用数据集 ID 填充密钥,但感觉不对。
我通过 REST API 向客户端提供 ID,对于简单的加载,我不需要额外的信息,只需要种类和密钥。
有没有我还没见过的 API 使用 kind/id 组合轻松检索实体的方法?我不能使用 Objectify Keys to just load the entity using the id, because it seems Objectify does not work with protobuffers (via
Cloud Datastore API 当前未定义规范的 web-safe 键表示,但我们最终希望定义。 https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/88