简体   繁体   English

Google Cloud Datastore API Java

[英]Google Cloud Datastore API Java

I have managed to import a version of the Google Cloud Datastore API in my project on Eclipse using Google Plugin Tool, yeah I know it is not a great achievement! 我已经使用Google Plugin Tool在Eclipse上的项目中成功导入了一个版本的Google Cloud Datastore API,是的,我知道这不是一个很大的成就!

But now what do I do....??? 但是现在我该怎么办.... ???

I can not find any correct functions for this API, either the functions are not resolved, or in other cases the imports are not resolved... 我找不到此API的任何正确函数,或者函数未解析,或者在其他情况下无法解析导入...

I am just trying to find a way to store some data on the Google Cloud. 我只是想找到一种在Google Cloud上存储一些数据的方法。 I am looking for just a few lines of Java code, something along the lines: 我在寻找的只是Java代码的几行,大致如下:

 import com.blah.blahblah
 . 
 .
 .
 main{
 Datastore mydata;
 mydata.put("Name", "myName"); }

Sort of thing. 那类的东西。 From all my reading for the past few days, it seems there are a couple of different APIs and I am using the wrong function names with the wrong API and I can't figure out how to match up the two...please some help as I am getting : ((( 从过去几天的所有阅读中,似乎有几个不同的API,并且我使用了错误的函数名和错误的API,但我不知道如何将两者匹配...请寻求帮助当我越来越:(((

Thank you. 谢谢。

If all you are trying to do is store data on the Google cloud, you have a few options. 如果您要做的就是将数据存储在Google云中,那么您可以选择几种方法。 the datastore, the blobstore, CloudSQL and the Cloud Storage. 数据存储区,blobstore,CloudSQL和云存储。 Each has its own unique strengths. 每个人都有其独特的优势。 Seems to me what you are looking for is a way to get started with an API, and I would recommend starting with this example: https://developers.google.com/appengine/docs/java/gettingstarted/introduction 在我看来,您正在寻找的是一种开始使用API​​的方法,我建议从以下示例开始: https : //developers.google.com/appengine/docs/java/gettingstarted/introduction

Using the Google Cloud Java client libraries: 使用Google Cloud Java客户端库:

import com.google.cloud.datastore.Datastore;
import com.google.cloud.datastore.DatastoreOptions;
import com.google.cloud.datastore.Entity;
import com.google.cloud.datastore.Key;
import com.google.cloud.datastore.KeyFactory;

Datastore datastore = DatastoreOptions.getDefaultInstance().getService();
KeyFactory keyFactory = datastore.newKeyFactory().setKind("myKind");
Key key = keyFactory.newKey("myKey");
Entity entity = Entity.newBuilder(key)
    .set("name", "Jane Doe")
    .set("age", 40)
    .build();
datastore.put(entity);

You can view the API documentation here , and don't forget you need to setup authentication correctly . 您可以在此处查看API文档 ,并且不要忘记需要正确设置身份验证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Cloud Datastore Java API线程安全吗? - Is the Google Cloud Datastore Java API threadsafe? 使用Google Cloud Dataflow的数据存储区Java API将属性设置为null吗? - Set a property to null with Google Cloud Dataflow's Java API for Datastore? 通过Gradle使用“ Java的Google Cloud Datastore API客户端库” - Using 'Google Cloud Datastore API Client Library for Java' with Gradle 适用于Google Cloud Datastore的android中的Google protobuf api - google protobuf api in android for google cloud datastore Google Cloud Datastore Java库中的allocateIds在哪里? - Where is allocateIds in the Google Cloud Datastore java library? Google Cloud Datastore-Java-GQLQuery游标 - Google Cloud Datastore - Java - GQLQuery Cursors 凭据Java应用程序连接到Google Cloud DataStore - Credentials Java application connect to google cloud datastore 使用Datastore Java API的WHERE子句(2-3个过滤器)查询时,Google Cloud Datastore Kind无法返回所有记录 - Google cloud Datastore Kind unable to return all records when queried with WHERE clause ( 2 - 3 filters ) using Datastore java API's 我们如何使用Google Cloud Java API进行数据存储不等式和“IN”过滤? - How do we do Datastore inequality and “IN” filters using the Google Cloud Java API? Google Cloud Endpoints与Cloud Datastore API服务之间的比较 - Comparison between Google Cloud Endpoints vs Cloud Datastore api Service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM