com.google.cloud.datastore.Query.newProjectionEntityQueryBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中com.google.cloud.datastore.Query.newProjectionEntityQueryBuilder方法的一些代码示例,展示了Query.newProjectionEntityQueryBuilder的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.newProjectionEntityQueryBuilder方法的具体详情如下:
包路径:com.google.cloud.datastore.Query
类名称:Query
方法名:newProjectionEntityQueryBuilder

Query.newProjectionEntityQueryBuilder介绍

[英]Returns a new StructuredQuery builder for projection queries.

Example of creating and running a projection entity query.

String kind = "my_kind";

[中]返回投影查询的新StructuredQuery builder。
创建和运行投影实体查询的示例。

String kind = "my_kind";

代码示例

代码示例来源:origin: googleapis/google-cloud-java

/** Example of creating and running a projection entity query. */
 // [TARGET newProjectionEntityQueryBuilder()]
 // [VARIABLE "my_kind"]
 // [VARIABLE "my_property"]
 public QueryResults<ProjectionEntity> newProjectionEntityQuery(String kind, String property) {
  // [START newProjectionEntityQuery]
  Query<ProjectionEntity> query =
    Query.newProjectionEntityQueryBuilder().setKind(kind).addProjection(property).build();
  QueryResults<ProjectionEntity> results = datastore.run(query);
  // Use results
  // [END newProjectionEntityQuery]
  return results;
 }
}

代码示例来源:origin: googleapis/google-cloud-java

Query.newProjectionEntityQueryBuilder().setKind(KIND1).setProjection("__key__").build();
StructuredQuery<ProjectionEntity> scKeyOnlyProjectionQuery =
  Query.newProjectionEntityQueryBuilder()
    .setKind(KIND1)
    .setFilter(PropertyFilter.hasAncestor(ROOT_KEY))
  Query.newProjectionEntityQueryBuilder()
    .setKind(KIND2)
    .setProjection("age")
  Query.newProjectionEntityQueryBuilder()
    .setKind(KIND2)
    .setFilter(PropertyFilter.hasAncestor(ROOT_KEY))

代码示例来源:origin: googleapis/google-cloud-java

.build();
Query<ProjectionEntity> scKeyProjectionQuery =
  Query.newProjectionEntityQueryBuilder()
    .addProjection("__key__")
    .setNamespace(NAMESPACE)

代码示例来源:origin: googleapis/google-cloud-java

Query.newProjectionEntityQueryBuilder().setKind(KIND1).setProjection("__key__").build();
QueryResults<ProjectionEntity> results3 = datastore.run(keyOnlyProjectionQuery);
assertTrue(results3.hasNext());
  Query.newProjectionEntityQueryBuilder()
    .setKind(KIND2)
    .setProjection("age")

代码示例来源:origin: org.eclipse.jetty.gcloud/jetty-gcloud-session-manager

Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
    .setKind(_model.getKind())
    .setProjection(_model.getId(), _model.getLastNode(), _model.getExpiry())

代码示例来源:origin: org.eclipse.jetty.gcloud/jetty-gcloud-session-manager

/**
 * Check to see if indexes are available, in which case
 * we can do more performant queries.
 * @return <code>true</code> if indexes are available
 */
protected boolean checkIndexes()
{
  try
  {
    Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
        .setKind(_model.getKind())
        .setProjection(_model.getExpiry())
        .setFilter(PropertyFilter.eq(_model.getId(), "-"))
        .build();
    _datastore.run(query);
    return true;
  }
  catch (DatastoreException e)
  {
    //need to assume that the problem is the index doesn't exist, because there
    //is no specific code for that
    if (LOG.isDebugEnabled())
      LOG.debug("Check for indexes", e);
    return false;
  }
}

代码示例来源:origin: org.eclipse.jetty.gcloud/jetty-gcloud-session-manager

Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
    .setKind(_model.getKind())
    .setProjection(_model.getExpiry())

相关文章