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

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

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

Query.startAt介绍

暂无

代码示例

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

/**
 * Fetches entities in batches and puts them into the buffer.
 */
private void batchFetching() {
  Query<T> newQuery = this.query.limit(BUFFER_SIZE);
  if (this.cursor != null) {
    newQuery = newQuery.startAt(this.cursor);
  }
  QueryResultIterator<T> iterator = newQuery.iterator();
  boolean shouldContinue = false;
  while (iterator.hasNext()) {
    shouldContinue = true;
    this.buffer.offer(iterator.next());
  }
  if (shouldContinue) {
    this.cursor = iterator.getCursor();
  }
}

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

Query<T> filterQueryKeys = getFilterQuery().limit(getCursorInformationPrintCycle());
if (cursor != null) {
  filterQueryKeys = filterQueryKeys.startAt(cursor);

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

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

代码示例来源: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");
}

相关文章