com.googlecode.objectify.cmd.Query.filter()方法的使用及代码示例

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

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

Query.filter介绍

[英]Create a filter based on the raw low-level Filter. This is a very low-level operation; the values in the Filter are not translated in any way. For example, this only understands native datastore Key objects and not Objectify Key objects.

See the Google documentation for indexes for an explanation of what you can and cannot filter for.

You can not filter on @Id or @Parent properties. Use filterKey() or ancestor() instead.
[中]基于原始低级过滤器创建过滤器。这是一个非常低级的操作;过滤器中的值不会以任何方式转换。例如,这只理解本机数据存储密钥对象,而不将密钥对象对象化。
请参阅{$0$}的谷歌文档,了解您可以过滤哪些内容,哪些内容不可以过滤。
不能对@Id或@Parent属性进行筛选。改用filterKey()或祖先()。

代码示例

代码示例来源:origin: TEAMMATES/teammates

ofy().load().type(CourseStudent.class)
        .filter("createdAt >", queryEntitiesFrom)
        .filter("createdAt <=", queryEntitiesTo);
Query<Account> accountQuery =
    ofy().load().type(Account.class)
        .filter("createdAt >", queryEntitiesFrom)
        .filter("createdAt <=", queryEntitiesTo);

代码示例来源:origin: omerio/appstart

/**
 * Find all todos which are completed, not archived and are older than the provided
 * date.
 * @param date
 * @return
 */
public static List<Todo> findAllToArchive(Date date)	{
  return ofy().load().type(Todo.class)
      .filter("archived", false)
      .filter("completed", true)
      .filter("dateAdded <=", date).list();
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public List<FormRecord> run() {
    QueryResultIterable<FormRecordEntity> query = ofy().load()
        .type(FormRecordEntity.class)
        .ancestor(FormEntity.key(formClass))
        .filter("parentRecordId", this.parentRecordId.asString())
        .iterable();

    List<FormRecord> records = Lists.newArrayList();
    for (FormRecordEntity entity : query) {
      records.add(entity.toFormRecord(formClass));

    }
    return records;
  }
}

代码示例来源:origin: bedatadriven/activityinfo

public void query(long localVersion, long toVersion, Optional<String> startAt) {
  LOGGER.info("Starting VersionRange query...");
  Stopwatch stopwatch = Stopwatch.createStarted();
  Query<FormRecordSnapshotEntity> query = ofy().load().type(FormRecordSnapshotEntity.class)
      .ancestor(FormEntity.key(formClass))
      .filter("version >", localVersion)
      .chunk(500);
  if(startAt.isPresent()) {
    query = query.startAt(Cursor.fromWebSafeString(startAt.get()));
  }
  QueryResultIterator<FormRecordSnapshotEntity> it = query.iterator();
  while(it.hasNext()) {
    FormRecordSnapshotEntity snapshot = it.next();
    if(snapshot.getVersion() <= toVersion) {
      add(snapshot);
      if(!sizeEstimator.timeAndSpaceRemaining()) {
        stop(it.getCursor().toWebSafeString());
        break;
      }
    }
  }
  LOGGER.info("VersionRange query complete in " + stopwatch.elapsed(TimeUnit.SECONDS) +
      " with estimate size: " + sizeEstimator.getEstimatedSizeInBytes() + " bytes");
}

代码示例来源:origin: bedatadriven/activityinfo

.type(FormRecordSnapshotEntity.class)
.ancestor(rootKey)
.filter("parentRecordId", parentRecordId.asString());

相关文章