是否推荐使用GAE类型?

发布于 2024-10-16 16:27:10 字数 355 浏览 5 评论 0原文

I see that GAE provides several types like Email or PostalAddress for its entities. I've read they don't provide any validation. So I wonder: what's the benefit of using them instead of storing the data on a simple String field? Any reason I should use them?

EDIT: answered at this question

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝不服输 2024-10-23 16:27:10

我希望谷歌能够回答这个问题。一些猜测:

  • Python 文档 讨论了这些属性的作用类型在 gdata 中表示。您可以从 gdata feed 实例化 Email 属性,然后将其设置在数据存储实体上吗?您的应用程序引擎应用程序(有一天)可以提供 gdata 风格的 Web 服务吗?
  • 也许 Google 对这些类型的存储要求有启发,可以帮助他们优化数据存储中的存储。
  • 也许他们会在以后的版本中为这些类型添加功能。
  • 也许他们喜欢为了打字而打字。

I hope Google answers this. Some guesses:

  • The Python docs talk about how these property types are represented in gdata. Can you instantiate an Email property from a gdata feed and then set it on a datastore entity? Could your app engine app (some day) provide a gdata-style web service?
  • Maybe Google has heuristics about the storage requirements of these types that help them optimize storage in the datastore.
  • Maybe they'll add functionality to these types in a later release.
  • Maybe they like typing for typing's sake.
半山落雨半山空 2024-10-23 16:27:10

目前,它们的唯一目的似乎是无缝转换为 Google 使用的 gdataatom feed。它们可能是在构建 GoogleApps 的框架上实现的字段,并且包含在 AppEngine 数据模型中。这样,如果您想制作一个与 GoogleApps 交互的应用程序,那就容易多了。

我还确信这些值已正确“标准化”以进行索引。 LinkProperty 的值很可能从 www.stackoverflow.com 更改为 com.stackoverflow.www。

Currently the only purpose for them seems to be that they seamlessly convert to gdata atom feeds which Google uses. They are probably fields that have been implemented on the framework which GoogleApps is built on and were included on the AppEngine data model. That way if you want to make an app that interacts with GoogleApps, it is that much easier.

I'm also certain that the values are "normalized" properly to be indexed. The value of the LinkProperty is most likely changed from www.stackoverflow.com to com.stackoverflow.www.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文