com.google.appengine.api.datastore.Query.isKeysOnly()方法的使用及代码示例

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

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

Query.isKeysOnly介绍

暂无

代码示例

代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine

StringBuilder str = new StringBuilder();
str.append("Kind=" + table);
if (primaryDatastoreQuery.isKeysOnly()) {
 str.append(" KEYS-ONLY");

代码示例来源:origin: com.googlecode.cedar-common/objectify

/**
 * Make a new Query object that is exactly like the old.  Too bad Query isn't Cloneable. 
 */
protected com.google.appengine.api.datastore.Query cloneRawQuery(com.google.appengine.api.datastore.Query orig)
{
  com.google.appengine.api.datastore.Query copy = new com.google.appengine.api.datastore.Query(orig.getKind(), orig.getAncestor());
  
  for (FilterPredicate filter: orig.getFilterPredicates())
    copy.addFilter(filter.getPropertyName(), filter.getOperator(), filter.getValue());
  
  for (SortPredicate sort: orig.getSortPredicates())
    copy.addSort(sort.getPropertyName(), sort.getDirection());
  
  // This should be impossible but who knows what might happen in the future
  if (orig.isKeysOnly())
    copy.setKeysOnly();
  
  return copy;
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

@Test
public void testCompositeFilter() {
  Query query = new Query(kindName, rootKey);
  Filter filter = Query.CompositeFilterOperator.and(
    Query.FilterOperator.LESS_THAN_OR_EQUAL.of("intData", 40),
    Query.FilterOperator.GREATER_THAN.of("intData", 0));
  query.setFilter(filter);
  query.addSort("intData", Query.SortDirection.DESCENDING);
  List<Entity> es = service.prepare(query).asList(fo);
  assertEquals("check return count", 2, es.size());
  assertEquals("check query filter", filter, query.getFilter());
  assertEquals("check query key only", false, query.isKeysOnly());
  Query.CompositeFilter cf = (Query.CompositeFilter) query.getFilter();
  assertEquals(2, cf.getSubFilters().size());
  assertEquals(Query.CompositeFilterOperator.AND, cf.getOperator());
}

相关文章