在GAE灵活环境中可以使用appengine/datastore包吗?

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

Is it possible to use the appengine/datastore package on the GAE flex environment?

问题

Google App Engine有两个不同的数据存储包:google.golang.org/appengine/datastorecloud.google.com/go/datastore

appengine/datastore包的文档使用标准环境,而cloud包的文档使用弹性环境。

我有一个使用标准GAE环境的Go应用程序,它使用appengine/datastore包。如果我想将这个应用程序从标准环境迁移到弹性环境,我需要切换到cloud.google.com/go/datastore包吗?还是可以继续使用appengine/datastore包?如果不能,为什么?

英文:

There are two different datastore packages for Google App Engine:
google.golang.org/appengine/datastore and cloud.google.com/go/datastore.

The documentation for the appengine/datastore package uses the standard environment while the documentation for the cloud package uses the flex environment.

I have a Go application which uses the appengine/datastore package on the standard GAE environment. If I want to migrate this application from the standard environment to the flex environment do I need to switch to the cloud.google.com/go/datastore package, or can I continue using the appengine/datastore package? If not, why not?

答案1

得分: 1

你需要迁移到cloud.google.com/go/datastore。

从标准环境迁移到灵活环境中:

> 弹性环境不提供App Engine SDK中的API库。如果你决定将应用程序从App Engine标准环境迁移到弹性环境,你必须更新你的代码,以使用在所有Google Cloud平台环境中可用的服务和API。

而从Cloud Datastore中:

> 你可以使用Cloud Datastore API从任何地方访问Google Cloud Datastore。使用Google Cloud客户端库来存储和检索Cloud Datastore中的数据。
>
> 无论你使用App Engine库、Google Cloud客户端库还是直接调用API,都可以访问相同的Cloud Datastore数据。
>
> 目前,标准环境中可用的ORM库(如ndb和Objectify)在标准环境之外不受支持。
>
> 更多信息,请参阅以下指南:
>
> - 使用Cloud Datastore

英文:

You need to migrate to cloud.google.com/go/datastore.

From Migrating Services from the Standard Environment to the Flexible Environment:

> The App Engine flexible environment does not provide the API libraries
> present in the App Engine SDK. If you decide to migrate your
> application from the App Engine standard environment to the flexible
> environment
, you must update your code to use services and APIs
> that are available across all Google Cloud Platform environments.

And from Cloud Datastore:

> You can access Google Cloud Datastore from anywhere using the
> Cloud Datastore API. Use the Google Cloud client libraries to
> store and retrieve data from Cloud Datastore.
>
> The same Cloud Datastore data is available regardless of if you use
> the App Engine libraries, the Google Cloud client libraries, or call
> the API directly.
>
> At this time ORM libraries that available in the standard environment
> such as ndb and Objectify are not supported outside of the
> standard environment.
>
> For more information, see the following guide:
>
> - Using Cloud Datastore

huangapple
  • 本文由 发表于 2017年3月18日 12:09:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/42870351.html
匿名

发表评论

匿名网友

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

确定