如何在Golang中定义未索引的Datastore属性?

huangapple go评论71阅读模式
英文:

How to define unindexed Datastore properties in Golang?

问题

我可以使用Golang在应用引擎上定义未索引的Datastore属性吗?

英文:

Can I define unindexed Datastore properties using Golang on app engine?

答案1

得分: 2

当然,只需将"noindex"添加到结构字段标签中即可:https://developers.google.com/appengine/docs/go/datastore/indexes#Go_Unindexed_properties

英文:

Sure, just add "noindex" to struct field tag: https://developers.google.com/appengine/docs/go/datastore/indexes#Go_Unindexed_properties

答案2

得分: 0

你可以使用结构标签来控制Datastore如何处理结构字段。要避免对字段进行索引,请按照以下方式操作:

        Age  int `datastore:",noindex"`
}```

有关更多信息,请参阅[文档](https://developers.google.com/appengine/docs/go/datastore/indexes#Go_Unindexed_properties)。

<details>
<summary>英文:</summary>

You can control how Datastore handles struct fields using struct tags. To avoid indexing a field, do the following:

```type Person struct {
        Age  int `datastore:&quot;,noindex&quot;`
}```

See [the documentation](https://developers.google.com/appengine/docs/go/datastore/indexes#Go_Unindexed_properties) for more information.

</details>



huangapple
  • 本文由 发表于 2014年4月19日 04:07:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/23161489.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定