google-app-engine - Go API 的 KEY_RESERVED_PROPERTY 等价物是什么?数据存储

标签 google-app-engine go google-cloud-datastore

我需要检查 key (即用户名)是否存在。 It seems KEY_RESERVED_PROPERTY 是可用于 java api 的特殊 key ,您可以使用它来实现最佳性能和强一致性,所以我想知道 Go 中是否有任何等效项。

目前我正在考虑使用用户名作为祖先 + KeysOnly() 的查询。

最佳答案

如果你look at the docs , KEY_RESERVED_PROPERTY 只是一个引用 key 的属性:

A reserved property name used to refer to the key of the entity. This string can be used for filtering and sorting by the entity key itself.

所以这没什么神奇的,您可以在 Go 中使用 __key__ 属性做同样的事情,如 in the docs 所述:

Key filters

To filter on the value of an entity's key, use the special property __key__:

q := datastore.NewQuery("Person").Filter("__key__ >", lastSeenKey)

关于google-app-engine - Go API 的 KEY_RESERVED_PROPERTY 等价物是什么?数据存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29551986/

相关文章:

go - 使用 go-sqlmock 在 SQL 查询中获取参数值

json - 使用 Go 解码 JSON

google-app-engine - 静态内容更改 Google App Engine

java - GAE 数据存储读取性能

c# - 如何从 C# 调用 Google App Engine 上的方法

database - 将字段添加到 App Engine 托管的数据库

go - 获取字符串数组中每个字符串的第一个字符

c# - Google Cloud Datastore 请求在我的浏览器中返回错误 400

google-app-engine - SDK 1.5.2 中的 "Advanced Query Planning"是否意味着我不再需要在 datastore-indexes.xml 文件中指定索引?

node.js - NX : Copy one extra file to build directory